TCPDUMP moon# tcpdump -i eth1 not port ssh and not port domain and not arp > /tmp/tcpdump.log 2>&1 & sun# tcpdump -i eth0 not port ssh and not port domain and not arp > /tmp/tcpdump.log 2>&1 & PRE-TEST moon# /etc/init.d/iptables start 2> /dev/null * Caching service dependencies ... [ ok ] * Starting firewall ... [ ok ] alice# /etc/init.d/iptables start 2> /dev/null * Caching service dependencies ... [ ok ] * Starting firewall ... [ ok ] venus# /etc/init.d/iptables start 2> /dev/null * Caching service dependencies ... [ ok ] * Starting firewall ... [ ok ] moon# ipsec start Starting strongSwan 4.2.17 IPsec [starter]... alice# ipsec start Starting strongSwan 4.2.17 IPsec [starter]... venus# ipsec start Starting strongSwan 4.2.17 IPsec [starter]... alice# sleep 2 alice# ipsec up wlan 002 "wlan" #1: initiating Main Mode 104 "wlan" #1: STATE_MAIN_I1: initiate 003 "wlan" #1: ignoring Vendor ID payload [strongSwan 4.2.17] 003 "wlan" #1: received Vendor ID payload [XAUTH] 003 "wlan" #1: received Vendor ID payload [Dead Peer Detection] 106 "wlan" #1: STATE_MAIN_I2: sent MI2, expecting MR2 002 "wlan" #1: we have a cert and are sending it upon request 108 "wlan" #1: STATE_MAIN_I3: sent MI3, expecting MR3 002 "wlan" #1: Peer ID is ID_FQDN: '@moon.strongswan.org' 002 "wlan" #1: crl not found 002 "wlan" #1: certificate status unknown 002 "wlan" #1: ISAKMP SA established 004 "wlan" #1: STATE_MAIN_I4: ISAKMP SA established 002 "wlan" #2: initiating Quick Mode RSASIG+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1} 112 "wlan" #2: STATE_QUICK_I1: initiate 002 "wlan" #2: sent QI2, IPsec SA established {ESP=>0xf3f12578 <0x38292af4} 004 "wlan" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0xf3f12578 <0x38292af4} venus# sleep 2 venus# ipsec up wlan 002 "wlan" #1: initiating Main Mode 104 "wlan" #1: STATE_MAIN_I1: initiate 003 "wlan" #1: ignoring Vendor ID payload [strongSwan 4.2.17] 003 "wlan" #1: received Vendor ID payload [XAUTH] 003 "wlan" #1: received Vendor ID payload [Dead Peer Detection] 106 "wlan" #1: STATE_MAIN_I2: sent MI2, expecting MR2 002 "wlan" #1: we have a cert and are sending it upon request 108 "wlan" #1: STATE_MAIN_I3: sent MI3, expecting MR3 002 "wlan" #1: Peer ID is ID_FQDN: '@moon.strongswan.org' 002 "wlan" #1: crl not found 002 "wlan" #1: certificate status unknown 002 "wlan" #1: ISAKMP SA established 004 "wlan" #1: STATE_MAIN_I4: ISAKMP SA established 002 "wlan" #2: initiating Quick Mode RSASIG+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1} 112 "wlan" #2: STATE_QUICK_I1: initiate 002 "wlan" #2: sent QI2, IPsec SA established {ESP=>0x4e34a916 <0x429ee0aa} 004 "wlan" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0x4e34a916 <0x429ee0aa} venus# sleep 2 TEST alice# ipsec status | grep 'wlan.*STATE_QUICK_I2.*IPsec SA established' [YES] 000 #2: "wlan" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 913s; newest IPSEC; eroute owner venus# ipsec status | grep 'wlan.*STATE_QUICK_I2.*IPsec SA established' [YES] 000 #2: "wlan" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 1000s; newest IPSEC; eroute owner moon# ipsec status | grep 'alice.*STATE_QUICK_R2.*IPsec SA established' [YES] 000 #2: "alice" STATE_QUICK_R2 (IPsec SA established); EVENT_SA_REPLACE in 1102s; newest IPSEC; eroute owner moon# ipsec status | grep 'venus.*STATE_QUICK_R2.*IPsec SA established' [YES] 000 #4: "venus" STATE_QUICK_R2 (IPsec SA established); EVENT_SA_REPLACE in 1107s; newest IPSEC; eroute owner alice# ping -c 1 10.1.0.20 | grep '64 bytes from 10.1.0.20: icmp_seq=1' [YES] 64 bytes from 10.1.0.20: icmp_seq=1 ttl=63 time=3.63 ms alice# ping -c 1 10.1.0.1 | grep '64 bytes from 10.1.0.1: icmp_seq=1' [YES] 64 bytes from 10.1.0.1: icmp_seq=1 ttl=64 time=0.563 ms alice# ping -c 1 192.168.0.1 | grep '64 bytes from 192.168.0.1: icmp_seq=1' [YES] 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.974 ms alice# ping -c 1 192.168.0.2 | grep '64 bytes from 192.168.0.2: icmp_seq=1' [YES] 64 bytes from 192.168.0.2: icmp_seq=1 ttl=63 time=14.6 ms venus# ping -c 1 192.168.0.2 | grep '64 bytes from 192.168.0.2: icmp_seq=1' [YES] 64 bytes from 192.168.0.2: icmp_seq=1 ttl=63 time=0.996 ms moon# killall tcpdump moon# cat /tmp/tcpdump.log | grep 'ESP' [YES] 15:32:19.515306 IP alice.strongswan.org > moon1.strongswan.org: ESP(spi=0xf3f12578,seq=0x1), length 132 15:32:19.515482 IP moon1.strongswan.org > venus.strongswan.org: ESP(spi=0x429ee0aa,seq=0x1), length 132 15:32:19.518384 IP venus.strongswan.org > moon1.strongswan.org: ESP(spi=0x4e34a916,seq=0x1), length 132 15:32:19.518503 IP moon1.strongswan.org > alice.strongswan.org: ESP(spi=0x38292af4,seq=0x1), length 132 15:32:19.802673 IP alice.strongswan.org > moon1.strongswan.org: ESP(spi=0xf3f12578,seq=0x2), length 132 15:32:19.802826 IP moon1.strongswan.org > alice.strongswan.org: ESP(spi=0x38292af4,seq=0x2), length 132 15:32:20.151279 IP alice.strongswan.org > moon1.strongswan.org: ESP(spi=0xf3f12578,seq=0x3), length 132 15:32:20.151437 IP moon1.strongswan.org > alice.strongswan.org: ESP(spi=0x38292af4,seq=0x3), length 132 15:32:20.422671 IP alice.strongswan.org > moon1.strongswan.org: ESP(spi=0xf3f12578,seq=0x4), length 132 15:32:20.434225 IP moon1.strongswan.org > alice.strongswan.org: ESP(spi=0x38292af4,seq=0x4), length 132 15:32:20.774218 IP venus.strongswan.org > moon1.strongswan.org: ESP(spi=0x4e34a916,seq=0x2), length 132 15:32:20.774820 IP moon1.strongswan.org > venus.strongswan.org: ESP(spi=0x429ee0aa,seq=0x2), length 132 sun# killall tcpdump sun# cat /tmp/tcpdump.log | grep 'ICMP' [YES] 15:32:20.732138 IP moon.strongswan.org > sun.strongswan.org: ICMP echo request, id 56089, seq 1, length 64 15:32:20.734959 IP sun.strongswan.org > moon.strongswan.org: ICMP echo reply, id 56089, seq 1, length 64 15:32:21.072554 IP moon.strongswan.org > sun.strongswan.org: ICMP echo request, id 33041, seq 1, length 64 15:32:21.072618 IP sun.strongswan.org > moon.strongswan.org: ICMP echo reply, id 33041, seq 1, length 64 POST-TEST moon# iptables -t nat -v -n -L POSTROUTING Chain POSTROUTING (policy ACCEPT 4 packets, 356 bytes) pkts bytes target prot opt in out source destination 2 168 SNAT icmp -- * eth0 10.1.0.0/16 0.0.0.0/0 to:192.168.0.1 2 120 SNAT tcp -- * eth0 10.1.0.0/16 0.0.0.0/0 to:192.168.0.1:2000-2100 moon# ipsec stop Stopping strongSwan IPsec... alice# ipsec stop Stopping strongSwan IPsec... venus# ipsec stop Stopping strongSwan IPsec... alice# /etc/init.d/iptables stop 2> /dev/null * Stopping firewall ... [ ok ] venus# /etc/init.d/iptables stop 2> /dev/null * Stopping firewall ... [ ok ] moon# /etc/init.d/iptables stop 2> /dev/null * Stopping firewall ... [ ok ] moon# conntrack -F