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.3.6 IPsec [starter]... alice# ipsec start Starting strongSwan 4.3.6 IPsec [starter]... venus# ipsec start Starting strongSwan 4.3.6 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] 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 PUBKEY+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1} 112 "wlan" #2: STATE_QUICK_I1: initiate 002 "wlan" #2: sent QI2, IPsec SA established {ESP=>0xe03182b2 <0xa5fbf2b5} 004 "wlan" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0xe03182b2 <0xa5fbf2b5} 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] 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 PUBKEY+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1} 112 "wlan" #2: STATE_QUICK_I1: initiate 002 "wlan" #2: sent QI2, IPsec SA established {ESP=>0x3fcb4509 <0x2609b04d} 004 "wlan" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0x3fcb4509 <0x2609b04d} 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 942s; 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 948s; 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.28 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.470 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.516 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=11.1 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.638 ms moon# killall tcpdump moon# cat /tmp/tcpdump.log | grep 'ESP' [YES] 23:52:52.624821 IP alice.strongswan.org > moon1.strongswan.org: ESP(spi=0xe03182b2,seq=0x1), length 132 23:52:52.624959 IP moon1.strongswan.org > venus.strongswan.org: ESP(spi=0x2609b04d,seq=0x1), length 132 23:52:52.627434 IP venus.strongswan.org > moon1.strongswan.org: ESP(spi=0x3fcb4509,seq=0x1), length 132 23:52:52.627514 IP moon1.strongswan.org > alice.strongswan.org: ESP(spi=0xa5fbf2b5,seq=0x1), length 132 23:52:52.802694 IP alice.strongswan.org > moon1.strongswan.org: ESP(spi=0xe03182b2,seq=0x2), length 132 23:52:52.802759 IP moon1.strongswan.org > alice.strongswan.org: ESP(spi=0xa5fbf2b5,seq=0x2), length 132 23:52:52.957857 IP alice.strongswan.org > moon1.strongswan.org: ESP(spi=0xe03182b2,seq=0x3), length 132 23:52:52.957932 IP moon1.strongswan.org > alice.strongswan.org: ESP(spi=0xa5fbf2b5,seq=0x3), length 132 23:52:53.133537 IP alice.strongswan.org > moon1.strongswan.org: ESP(spi=0xe03182b2,seq=0x4), length 132 23:52:53.144257 IP moon1.strongswan.org > alice.strongswan.org: ESP(spi=0xa5fbf2b5,seq=0x4), length 132 23:52:53.294253 IP venus.strongswan.org > moon1.strongswan.org: ESP(spi=0x3fcb4509,seq=0x2), length 132 23:52:53.294609 IP moon1.strongswan.org > venus.strongswan.org: ESP(spi=0x2609b04d,seq=0x2), length 132 sun# killall tcpdump sun# cat /tmp/tcpdump.log | grep 'ICMP' [YES] 23:52:53.045592 IP moon.strongswan.org > sun.strongswan.org: ICMP echo request, id 15130, seq 1, length 64 23:52:53.046996 IP sun.strongswan.org > moon.strongswan.org: ICMP echo reply, id 15130, seq 1, length 64 23:52:53.195844 IP moon.strongswan.org > sun.strongswan.org: ICMP echo request, id 55313, seq 1, length 64 23:52:53.195871 IP sun.strongswan.org > moon.strongswan.org: ICMP echo reply, id 55313, 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