TCPDUMP moon# tcpdump -i eth0 not port ssh and not port domain and not arp > /tmp/tcpdump.log 2>&1 & PRE-TEST alice# /etc/init.d/iptables start 2> /dev/null * Caching service dependencies ... [ ok ] * Starting firewall ... [ ok ] sun# /etc/init.d/iptables start 2> /dev/null * Caching service dependencies ... [ ok ] * Starting firewall ... [ ok ] moon# echo 1 > /proc/sys/net/ipv4/ip_forward moon# iptables -t nat -A POSTROUTING -o eth0 -s 10.1.0.0/16 -p udp -j SNAT --to-source 192.168.0.1:1024-1100 moon# iptables -t nat -A POSTROUTING -o eth0 -s 10.1.0.0/16 -p tcp -j SNAT --to-source 192.168.0.1:2000-2100 alice# ipsec start Starting strongSwan 4.3.6 IPsec [starter]... sun# ipsec start Starting strongSwan 4.3.6 IPsec [starter]... alice# sleep 5 alice# ipsec up nat-t 002 "nat-t" #1: initiating Main Mode 104 "nat-t" #1: STATE_MAIN_I1: initiate 003 "nat-t" #1: ignoring Vendor ID payload [strongSwan] 003 "nat-t" #1: received Vendor ID payload [XAUTH] 003 "nat-t" #1: received Vendor ID payload [Dead Peer Detection] 003 "nat-t" #1: received Vendor ID payload [RFC 3947] 002 "nat-t" #1: enabling possible NAT-traversal with method 3 106 "nat-t" #1: STATE_MAIN_I2: sent MI2, expecting MR2 003 "nat-t" #1: NAT-Traversal: Result using RFC 3947: i am NATed 002 "nat-t" #1: we have a cert and are sending it upon request 108 "nat-t" #1: STATE_MAIN_I3: sent MI3, expecting MR3 002 "nat-t" #1: Peer ID is ID_FQDN: 'sun.strongswan.org' 002 "nat-t" #1: crl not found 002 "nat-t" #1: certificate status unknown 002 "nat-t" #1: ISAKMP SA established 004 "nat-t" #1: STATE_MAIN_I4: ISAKMP SA established 002 "nat-t" #2: initiating Quick Mode PUBKEY+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1} 112 "nat-t" #2: STATE_QUICK_I1: initiate 002 "nat-t" #2: sent QI2, IPsec SA established {ESP=>0x8d4f12ed <0xeb669e58 NATOA=0.0.0.0} 004 "nat-t" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0x8d4f12ed <0xeb669e58 NATOA=0.0.0.0} TEST alice# ipsec status | grep 'nat-t.*STATE_QUICK_I2.*IPsec SA established' [YES] 000 #2: "nat-t" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 950s; newest IPSEC; eroute owner sun# ipsec status | grep 'nat-t.*STATE_QUICK_R2.*IPsec SA established' [YES] 000 #2: "nat-t"[2] 192.168.0.1:1024 STATE_QUICK_R2 (IPsec SA established); EVENT_SA_REPLACE in 1110s; newest IPSEC; eroute owner alice# ping -c 1 10.2.0.10 | grep '64 bytes from 10.2.0.10: icmp_seq=1' [YES] 64 bytes from 10.2.0.10: icmp_seq=1 ttl=63 time=1.97 ms moon# killall tcpdump moon# cat /tmp/tcpdump.log | grep 'IP moon.strongswan.org.* > sun.strongswan.org.ipsec-nat-t: UDP' [YES] 23:26:50.649091 IP moon.strongswan.org.1024 > sun.strongswan.org.ipsec-nat-t: UDP-encap: ESP(spi=0x8d4f12ed,seq=0x1), length 132 moon# cat /tmp/tcpdump.log | grep 'IP sun.strongswan.org.ipsec-nat-t > moon.strongswan.org.*: UDP' [YES] 23:26:50.650356 IP sun.strongswan.org.ipsec-nat-t > moon.strongswan.org.1024: UDP-encap: ESP(spi=0xeb669e58,seq=0x1), length 132 POST-TEST alice# ipsec stop Stopping strongSwan IPsec... sun# ipsec stop Stopping strongSwan IPsec... alice# /etc/init.d/iptables stop 2> /dev/null * Stopping firewall ... [ ok ] sun# /etc/init.d/iptables stop 2> /dev/null * Stopping firewall ... [ ok ] moon# iptables -t nat -F moon# conntrack -F