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 moon# ipsec up host-host 002 "host-host" #1: initiating Main Mode 104 "host-host" #1: STATE_MAIN_I1: initiate 003 "host-host" #1: ignoring Vendor ID payload [strongSwan 2.8.8] 003 "host-host" #1: received Vendor ID payload [XAUTH] 003 "host-host" #1: received Vendor ID payload [Dead Peer Detection] 106 "host-host" #1: STATE_MAIN_I2: sent MI2, expecting MR2 002 "host-host" #1: we have a cert and are sending it 108 "host-host" #1: STATE_MAIN_I3: sent MI3, expecting MR3 002 "host-host" #1: Peer ID is ID_FQDN: '@sun.strongswan.org' 002 "host-host" #1: crl not found 002 "host-host" #1: certificate status unknown 002 "host-host" #1: ISAKMP SA established 004 "host-host" #1: STATE_MAIN_I4: ISAKMP SA established 002 "host-host" #2: initiating Quick Mode RSASIG+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1} 112 "host-host" #2: STATE_QUICK_I1: initiate 002 "host-host" #2: sent QI2, IPsec SA established {ESP=>0xd9d4184d <0x9ccfde0c} 004 "host-host" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0xd9d4184d <0x9ccfde0c} TEST moon# ipsec status | grep 'host-host.*STATE_QUICK_I2.*IPsec SA established' [YES] 000 #2: "host-host" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 897s; newest IPSEC; eroute owner sun# ipsec status | grep 'host-host.*STATE_QUICK_R2.*IPsec SA established' [YES] 000 #2: "host-host" STATE_QUICK_R2 (IPsec SA established); EVENT_SA_REPLACE in 1110s; newest IPSEC; eroute owner moon# 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=64 time=0.837 ms sun# killall tcpdump sun# cat /tmp/tcpdump.log | grep 'IP moon.strongswan.org > sun.strongswan.org: ESP' [YES] 12:09:02.540633 IP moon.strongswan.org > sun.strongswan.org: ESP(spi=0xd9d4184d,seq=0x1), length 116 sun# cat /tmp/tcpdump.log | grep 'IP sun.strongswan.org > moon.strongswan.org: ESP' [YES] 12:09:02.540752 IP sun.strongswan.org > moon.strongswan.org: ESP(spi=0x9ccfde0c,seq=0x1), 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 1 84 ACCEPT all -- eth0 * 192.168.0.2 192.168.0.1 policy match dir in pol ipsec reqid 16385 proto 50 1 136 ACCEPT esp -- eth0 * 0.0.0.0/0 0.0.0.0/0 4 2184 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 211 29892 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 Chain OUTPUT (policy DROP 2 packets, 216 bytes) pkts bytes target prot opt in out source destination 1 84 ACCEPT all -- * eth0 192.168.0.1 192.168.0.2 policy match dir out pol ipsec reqid 16385 proto 50 1 136 ACCEPT esp -- * eth0 0.0.0.0/0 0.0.0.0/0 5 2384 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 221 46188 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:22 sun# iptables -v -n -L Chain INPUT (policy DROP 1 packets, 52 bytes) pkts bytes target prot opt in out source destination 1 84 ACCEPT all -- eth0 * 192.168.0.1 192.168.0.2 policy match dir in pol ipsec reqid 16385 proto 50 1 136 ACCEPT esp -- eth0 * 0.0.0.0/0 0.0.0.0/0 5 2384 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 Chain OUTPUT (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 1 84 ACCEPT all -- * eth0 192.168.0.2 192.168.0.1 policy match dir out pol ipsec reqid 16385 proto 50 1 136 ACCEPT esp -- * eth0 0.0.0.0/0 0.0.0.0/0 4 2184 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 197 43612 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 ]