TCPDUMP 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 * Starting firewall ... [ ok ] sun# /etc/init.d/iptables start 2> /dev/null * Starting firewall ... [ ok ] moon# ipsec start Starting strongSwan IPsec 2.8.8 [starter]... sun# ipsec start Starting strongSwan IPsec 2.8.8 [starter]... moon# sleep 2 alice# ping -c 10 10.2.0.10 PING 10.2.0.10 (10.2.0.10) 56(84) bytes of data. 64 bytes from 10.2.0.10: icmp_seq=4 ttl=62 time=16.7 ms 64 bytes from 10.2.0.10: icmp_seq=5 ttl=62 time=0.558 ms 64 bytes from 10.2.0.10: icmp_seq=6 ttl=62 time=0.523 ms 64 bytes from 10.2.0.10: icmp_seq=7 ttl=62 time=0.485 ms 64 bytes from 10.2.0.10: icmp_seq=8 ttl=62 time=1.11 ms 64 bytes from 10.2.0.10: icmp_seq=9 ttl=62 time=1.08 ms 64 bytes from 10.2.0.10: icmp_seq=10 ttl=62 time=1.26 ms --- 10.2.0.10 ping statistics --- 10 packets transmitted, 7 received, 30% packet loss, time 9033ms rtt min/avg/max/mdev = 0.485/3.111/16.745/5.574 ms TEST moon# cat /var/log/auth.log | grep 'initiate on demand from 10.1.0.10' [YES] Dec 6 12:27:06 moon pluto[24600]: | initiate on demand from 10.1.0.10:8 to 10.2.0.10:0 proto=1 state: fos_start because: whack moon# ipsec status | grep 'net-net.*STATE_QUICK_I2.*IPsec SA established' [YES] 000 #2: "net-net" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 996s; newest IPSEC; eroute owner sun# ipsec status | grep 'net-net.*STATE_QUICK_R2.*IPsec SA established' [YES] 000 #2: "net-net" STATE_QUICK_R2 (IPsec SA established); EVENT_SA_REPLACE in 1103s; 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=62 time=0.636 ms sun# killall tcpdump sun# cat /tmp/tcpdump.log | grep 'IP moon.strongswan.org > sun.strongswan.org: ESP' [YES] 12:27:09.314793 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0x1a23ace4,seq=0x1), length 116 12:27:10.322825 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0x1a23ace4,seq=0x2), length 116 12:27:11.322859 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0x1a23ace4,seq=0x3), length 116 12:27:12.321863 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0x1a23ace4,seq=0x4), length 116 12:27:13.321094 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0x1a23ace4,seq=0x5), length 116 12:27:14.320129 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0x1a23ace4,seq=0x6), length 116 12:27:15.319529 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0x1a23ace4,seq=0x7), length 116 12:27:16.895383 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0x1a23ace4,seq=0x8), length 116 sun# cat /tmp/tcpdump.log | grep 'IP sun.strongswan.org > moon.strongswan.org: ESP' [YES] 12:27:09.331106 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0xa2800da6,seq=0x1), length 116 12:27:10.323062 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0xa2800da6,seq=0x2), length 116 12:27:11.323087 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0xa2800da6,seq=0x3), length 116 12:27:12.322065 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0xa2800da6,seq=0x4), length 116 12:27:13.321569 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0xa2800da6,seq=0x5), length 116 12:27:14.320583 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0xa2800da6,seq=0x6), length 116 12:27:15.320066 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0xa2800da6,seq=0x7), length 116 12:27:16.895649 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0xa2800da6,seq=0x8), length 116 POST-TEST moon# iptables -v -n -L Chain INPUT (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 8 1088 ACCEPT esp -- eth0 * 0.0.0.0/0 0.0.0.0/0 4 2216 ACCEPT udp -- eth0 * 0.0.0.0/0 0.0.0.0/0 udp spt:500 dpt:500 4 1003 ACCEPT tcp -- eth0 * 192.168.0.150 0.0.0.0/0 tcp spt:80 177 26264 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 Chain FORWARD (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 8 672 ACCEPT all -- eth0 * 10.2.0.0/16 10.1.0.0/16 policy match dir in pol ipsec reqid 16385 proto 50 8 672 ACCEPT all -- * eth0 10.1.0.0/16 10.2.0.0/16 policy match dir out pol ipsec reqid 16385 proto 50 Chain OUTPUT (policy DROP 1 packets, 116 bytes) pkts bytes target prot opt in out source destination 8 1088 ACCEPT esp -- * eth0 0.0.0.0/0 0.0.0.0/0 5 2416 ACCEPT udp -- * eth0 0.0.0.0/0 0.0.0.0/0 udp spt:500 dpt:500 6 391 ACCEPT tcp -- * eth0 0.0.0.0/0 192.168.0.150 tcp dpt:80 194 56220 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:22 sun# iptables -v -n -L Chain INPUT (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 8 1088 ACCEPT esp -- eth0 * 0.0.0.0/0 0.0.0.0/0 5 2416 ACCEPT udp -- eth0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:500 0 0 ACCEPT udp -- eth0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:4500 4 1003 ACCEPT tcp -- eth0 * 192.168.0.150 0.0.0.0/0 tcp spt:80 190 28800 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 Chain FORWARD (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 8 672 ACCEPT all -- eth0 * 10.1.0.0/16 10.2.0.0/16 policy match dir in pol ipsec reqid 16385 proto 50 8 672 ACCEPT all -- * eth0 10.2.0.0/16 10.1.0.0/16 policy match dir out pol ipsec reqid 16385 proto 50 Chain OUTPUT (policy DROP 1 packets, 116 bytes) pkts bytes target prot opt in out source destination 8 1088 ACCEPT esp -- * eth0 0.0.0.0/0 0.0.0.0/0 4 2216 ACCEPT udp -- * eth0 0.0.0.0/0 0.0.0.0/0 udp spt:500 0 0 ACCEPT udp -- * eth0 0.0.0.0/0 0.0.0.0/0 udp spt:4500 6 391 ACCEPT tcp -- * eth0 0.0.0.0/0 192.168.0.150 tcp dpt:80 203 54948 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:22 moon# ipsec stop Stopping strongSwan IPsec... sun# ipsec stop Stopping strongSwan IPsec... moon# /etc/init.d/iptables stop 2> /dev/null * Stopping firewall ... [ ok ] sun# /etc/init.d/iptables stop 2> /dev/null * Stopping firewall ... [ ok ]