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.11 [starter]... sun# ipsec start Starting strongSwan IPsec 2.8.11 [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=1.30 ms 64 bytes from 10.2.0.10: icmp_seq=5 ttl=62 time=1.21 ms 64 bytes from 10.2.0.10: icmp_seq=6 ttl=62 time=1.09 ms 64 bytes from 10.2.0.10: icmp_seq=7 ttl=62 time=1.09 ms 64 bytes from 10.2.0.10: icmp_seq=8 ttl=62 time=1.12 ms 64 bytes from 10.2.0.10: icmp_seq=9 ttl=62 time=1.27 ms 64 bytes from 10.2.0.10: icmp_seq=10 ttl=62 time=1.05 ms --- 10.2.0.10 ping statistics --- 10 packets transmitted, 7 received, 30% packet loss, time 9059ms rtt min/avg/max/mdev = 1.051/1.165/1.307/0.094 ms TEST moon# cat /var/log/auth.log | grep 'initiate on demand from 10.1.0.10' [YES] Jul 20 07:28:06 moon pluto[12156]: | 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 964s; 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 1102s; 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=1.47 ms sun# killall tcpdump sun# cat /tmp/tcpdump.log | grep 'IP moon.strongswan.org > sun.strongswan.org: ESP' [YES] 07:28:08.914067 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0xef70015e,seq=0x1), length 116 07:28:09.915479 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0xef70015e,seq=0x2), length 116 07:28:10.925126 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0xef70015e,seq=0x3), length 116 07:28:11.926375 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0xef70015e,seq=0x4), length 116 07:28:12.936567 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0xef70015e,seq=0x5), length 116 07:28:13.947042 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0xef70015e,seq=0x6), length 116 07:28:14.957187 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0xef70015e,seq=0x7), length 116 07:28:17.451698 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0xef70015e,seq=0x8), length 116 sun# cat /tmp/tcpdump.log | grep 'IP sun.strongswan.org > moon.strongswan.org: ESP' [YES] 07:28:08.914559 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0x258123c2,seq=0x1), length 116 07:28:09.915921 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0x258123c2,seq=0x2), length 116 07:28:10.925556 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0x258123c2,seq=0x3), length 116 07:28:11.926828 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0x258123c2,seq=0x4), length 116 07:28:12.937056 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0x258123c2,seq=0x5), length 116 07:28:13.947447 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0x258123c2,seq=0x6), length 116 07:28:14.957609 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0x258123c2,seq=0x7), length 116 07:28:17.452312 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0x258123c2,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 1008 ACCEPT tcp -- eth0 * 192.168.0.150 0.0.0.0/0 tcp spt:80 254 31951 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 Chain FORWARD (policy DROP 1 packets, 84 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 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 spt:500 dpt:500 6 391 ACCEPT tcp -- * eth0 0.0.0.0/0 192.168.0.150 tcp dpt:80 330 70261 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 1008 ACCEPT tcp -- eth0 * 192.168.0.150 0.0.0.0/0 tcp spt:80 328 37846 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 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 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 369 66774 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 ]