TCPDUMP moon# tcpdump -i eth0 not port ssh and not port domain and not arp > /tmp/tcpdump.log 2>&1 & alice# 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 ] carol# /etc/init.d/iptables start 2> /dev/null * Starting firewall ... [ ok ] dave# /etc/init.d/iptables start 2> /dev/null * Starting firewall ... [ ok ] carol# ipsec start Starting strongSwan IPsec 2.8.8 [starter]... dave# ipsec start Starting strongSwan IPsec 2.8.8 [starter]... moon# ipsec start Starting strongSwan IPsec 2.8.8 [starter]... carol# sleep 2 carol# ipsec up home 002 "home" #1: initiating Main Mode 104 "home" #1: STATE_MAIN_I1: initiate 003 "home" #1: ignoring Vendor ID payload [strongSwan 2.8.8] 003 "home" #1: received Vendor ID payload [XAUTH] 003 "home" #1: received Vendor ID payload [Dead Peer Detection] 106 "home" #1: STATE_MAIN_I2: sent MI2, expecting MR2 002 "home" #1: we have a cert and are sending it 108 "home" #1: STATE_MAIN_I3: sent MI3, expecting MR3 002 "home" #1: Peer ID is ID_FQDN: '@moon.strongswan.org' 002 "home" #1: crl not found 002 "home" #1: certificate status unknown 002 "home" #1: ISAKMP SA established 004 "home" #1: STATE_MAIN_I4: ISAKMP SA established 002 "home" #1: parsing ModeCfg set 002 "home" #1: setting virtual IP source address to 10.3.0.1 002 "home" #1: sending ModeCfg ack 002 "home" #1: sent ModeCfg ack, established 004 "home" #1: STATE_MODE_CFG_I3: sent ModeCfg ack, established 002 "home" #2: initiating Quick Mode RSASIG+ENCRYPT+TUNNEL+PFS+UP+MODECFGPUSH {using isakmp#1} 112 "home" #2: STATE_QUICK_I1: initiate 002 "home" #2: sent QI2, IPsec SA established {ESP=>0xe7be1be1 <0x5c424208} 004 "home" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0xe7be1be1 <0x5c424208} dave# ipsec up home 002 "home" #1: initiating Main Mode 104 "home" #1: STATE_MAIN_I1: initiate 003 "home" #1: ignoring Vendor ID payload [strongSwan 2.8.8] 003 "home" #1: received Vendor ID payload [XAUTH] 003 "home" #1: received Vendor ID payload [Dead Peer Detection] 106 "home" #1: STATE_MAIN_I2: sent MI2, expecting MR2 002 "home" #1: we have a cert and are sending it 108 "home" #1: STATE_MAIN_I3: sent MI3, expecting MR3 002 "home" #1: Peer ID is ID_FQDN: '@moon.strongswan.org' 002 "home" #1: crl not found 002 "home" #1: certificate status unknown 002 "home" #1: ISAKMP SA established 004 "home" #1: STATE_MAIN_I4: ISAKMP SA established 002 "home" #1: parsing ModeCfg set 002 "home" #1: setting virtual IP source address to 10.3.0.2 002 "home" #1: sending ModeCfg ack 002 "home" #1: sent ModeCfg ack, established 004 "home" #1: STATE_MODE_CFG_I3: sent ModeCfg ack, established 002 "home" #2: initiating Quick Mode RSASIG+ENCRYPT+TUNNEL+PFS+UP+MODECFGPUSH {using isakmp#1} 112 "home" #2: STATE_QUICK_I1: initiate 002 "home" #2: sent QI2, IPsec SA established {ESP=>0x1c6ac973 <0xc5537afb} 004 "home" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0x1c6ac973 <0xc5537afb} TEST carol# cat /var/log/auth.log | grep 'setting virtual IP source address to 10.3.0.1' [YES] Dec 6 12:12:14 carol pluto[17672]: "home" #1: setting virtual IP source address to 10.3.0.1 carol# ipsec status | grep 'home.*STATE_QUICK_I2.*IPsec SA established' [YES] 000 #2: "home" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 871s; newest IPSEC; eroute owner carol# ping -c 1 10.1.0.10 | grep '64 bytes from 10.1.0.10: icmp_seq=1' [YES] 64 bytes from 10.1.0.10: icmp_seq=1 ttl=63 time=0.535 ms dave# cat /var/log/auth.log | grep 'setting virtual IP source address to 10.3.0.2' [YES] Dec 6 12:12:17 dave pluto[8172]: "home" #1: setting virtual IP source address to 10.3.0.2 dave# ipsec status | grep 'home.*STATE_QUICK_I2.*IPsec SA established' [YES] 000 #2: "home" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 991s; newest IPSEC; eroute owner dave# ping -c 1 10.1.0.10 | grep '64 bytes from 10.1.0.10: icmp_seq=1' [YES] 64 bytes from 10.1.0.10: icmp_seq=1 ttl=63 time=0.833 ms moon# ipsec status | grep 'rw-carol.*STATE_QUICK_R2.*IPsec SA established' [YES] 000 #2: "rw-carol"[1] 192.168.0.100 STATE_QUICK_R2 (IPsec SA established); EVENT_SA_REPLACE in 1107s; newest IPSEC; eroute owner moon# ipsec status | grep 'rw-dave.*STATE_QUICK_R2.*IPsec SA established' [YES] 000 #4: "rw-dave"[2] 192.168.0.200 STATE_QUICK_R2 (IPsec SA established); EVENT_SA_REPLACE in 1109s; newest IPSEC; eroute owner moon# killall tcpdump moon# cat /tmp/tcpdump.log | grep 'IP carol.strongswan.org > moon.strongswan.org: ESP' [YES] 12:12:19.368573 IP carol.strongswan.org > moon.strongswan.org: ESP(spi=0xe7be1be1,seq=0x1), length 116 moon# cat /tmp/tcpdump.log | grep 'IP moon.strongswan.org > carol.strongswan.org: ESP' [YES] 12:12:19.368913 IP moon.strongswan.org > carol.strongswan.org: ESP(spi=0x5c424208,seq=0x1), length 116 moon# cat /tmp/tcpdump.log | grep 'IP dave.strongswan.org > moon.strongswan.org: ESP' [YES] 12:12:19.763595 IP dave.strongswan.org > moon.strongswan.org: ESP(spi=0x1c6ac973,seq=0x1), length 116 moon# cat /tmp/tcpdump.log | grep 'IP moon.strongswan.org > dave.strongswan.org: ESP' [YES] 12:12:19.763903 IP moon.strongswan.org > dave.strongswan.org: ESP(spi=0xc5537afb,seq=0x1), length 116 alice# killall tcpdump alice# cat /tmp/tcpdump.log | grep 'IP carol1.strongswan.org > alice.strongswan.org: ICMP echo request' [YES] 12:12:19.401161 IP carol1.strongswan.org > alice.strongswan.org: ICMP echo request, id 16965, seq 1, length 64 alice# cat /tmp/tcpdump.log | grep 'IP alice.strongswan.org > carol1.strongswan.org: ICMP echo reply' [YES] 12:12:19.402096 IP alice.strongswan.org > carol1.strongswan.org: ICMP echo reply, id 16965, seq 1, length 64 alice# cat /tmp/tcpdump.log | grep 'IP dave1.strongswan.org > alice.strongswan.org: ICMP echo request' [YES] 12:12:19.763762 IP dave1.strongswan.org > alice.strongswan.org: ICMP echo request, id 8992, seq 1, length 64 alice# cat /tmp/tcpdump.log | grep 'IP alice.strongswan.org > dave1.strongswan.org: ICMP echo reply' [YES] 12:12:19.763795 IP alice.strongswan.org > dave1.strongswan.org: ICMP echo reply, id 8992, seq 1, length 64 POST-TEST moon# iptables -v -n -L Chain INPUT (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- eth0 * 10.3.0.2 10.1.0.0/16 policy match dir in pol ipsec reqid 16401 proto 50 0 0 ACCEPT all -- eth0 * 10.3.0.1 10.1.0.0/16 policy match dir in pol ipsec reqid 16397 proto 50 2 272 ACCEPT esp -- eth0 * 0.0.0.0/0 0.0.0.0/0 12 5072 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 249 37460 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 1 84 ACCEPT all -- eth0 * 10.3.0.2 10.1.0.0/16 policy match dir in pol ipsec reqid 16401 proto 50 1 84 ACCEPT all -- * eth0 10.1.0.0/16 10.3.0.2 policy match dir out pol ipsec reqid 16401 proto 50 1 84 ACCEPT all -- eth0 * 10.3.0.1 10.1.0.0/16 policy match dir in pol ipsec reqid 16397 proto 50 1 84 ACCEPT all -- * eth0 10.1.0.0/16 10.3.0.1 policy match dir out pol ipsec reqid 16397 proto 50 Chain OUTPUT (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- * eth0 10.1.0.0/16 10.3.0.2 policy match dir out pol ipsec reqid 16401 proto 50 0 0 ACCEPT all -- * eth0 10.1.0.0/16 10.3.0.1 policy match dir out pol ipsec reqid 16397 proto 50 2 272 ACCEPT esp -- * eth0 0.0.0.0/0 0.0.0.0/0 10 4624 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 267 74400 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:22 carol# 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 * 10.1.0.0/16 10.3.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 5 2312 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 236 33052 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 0 0 ACCEPT all -- eth0 * 10.1.0.0/16 10.3.0.1 policy match dir in pol ipsec reqid 16385 proto 50 0 0 ACCEPT all -- * eth0 10.3.0.1 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 1 84 ACCEPT all -- * eth0 10.3.0.1 10.1.0.0/16 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 6 2536 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 250 66564 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:22 dave# 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 * 10.1.0.0/16 10.3.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 2312 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 217 30204 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 0 0 ACCEPT all -- eth0 * 10.1.0.0/16 10.3.0.2 policy match dir in pol ipsec reqid 16385 proto 50 0 0 ACCEPT all -- * eth0 10.3.0.2 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 1 84 ACCEPT all -- * eth0 10.3.0.2 10.1.0.0/16 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 6 2536 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 233 61948 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:22 moon# ipsec stop Stopping strongSwan IPsec... carol# ipsec stop Stopping strongSwan IPsec... dave# ipsec stop Stopping strongSwan IPsec... moon# /etc/init.d/iptables stop 2> /dev/null * Stopping firewall ... [ ok ] carol# /etc/init.d/iptables stop 2> /dev/null * Stopping firewall ... [ ok ] dave# /etc/init.d/iptables stop 2> /dev/null * Stopping firewall ... [ ok ] carol# ip addr del 10.3.0.1/32 dev eth0 dave# ip addr del 10.3.0.2/32 dev eth0