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# cat /etc/ipsec.d/tables.sql > /etc/ipsec.d/ipsec.sql moon# cat /etc/ipsec.d/ipsec.sql | sqlite3 /etc/ipsec.d/ipsec.db moon# ipsec pool --add bigpool --start 10.3.0.1 --end 10.3.3.232 --timeout 0 2> /dev/null allocating 1000 addresses... done. moon# ipsec pool --add dns --server 192.168.0.150 2> /dev/null added dns server 192.168.0.150 moon# ipsec pool --add dns --server 10.1.0.20 2> /dev/null added dns server 10.1.0.20 moon# ipsec pool --add nbns --server 10.1.0.20 2> /dev/null added nbns server 10.1.0.20 moon# /etc/init.d/iptables start 2> /dev/null * Caching service dependencies ... [ ok ] * Starting firewall ... [ ok ] carol# /etc/init.d/iptables start 2> /dev/null * Caching service dependencies ... [ ok ] * Starting firewall ... [ ok ] dave# /etc/init.d/iptables start 2> /dev/null * Caching service dependencies ... [ ok ] * Starting firewall ... [ ok ] carol# ipsec start Starting strongSwan 4.3.6 IPsec [starter]... dave# ipsec start Starting strongSwan 4.3.6 IPsec [starter]... moon# ipsec start Starting strongSwan 4.3.6 IPsec [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] 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 upon request 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: sending ModeCfg request 002 "home" #1: parsing ModeCfg reply 002 "home" #1: received IPv4 DNS server address 192.168.0.150 002 "home" #1: received IPv4 DNS server address 10.1.0.20 002 "home" #1: received IPv4 NBNS server address 10.1.0.20 002 "home" #1: setting virtual IP source address to 10.3.0.1 002 "home" #1: received ModeCfg reply, established 004 "home" #1: STATE_MODE_CFG_I2: received ModeCfg reply, established 002 "home" #2: initiating Quick Mode PUBKEY+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1} 112 "home" #2: STATE_QUICK_I1: initiate 002 "home" #2: sent QI2, IPsec SA established {ESP=>0x624d26f6 <0x07bfee53} 004 "home" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0x624d26f6 <0x07bfee53} 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] 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 upon request 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: sending ModeCfg request 002 "home" #1: parsing ModeCfg reply 002 "home" #1: received IPv4 DNS server address 192.168.0.150 002 "home" #1: received IPv4 DNS server address 10.1.0.20 002 "home" #1: received IPv4 NBNS server address 10.1.0.20 002 "home" #1: setting virtual IP source address to 10.3.0.2 002 "home" #1: received ModeCfg reply, established 004 "home" #1: STATE_MODE_CFG_I2: received ModeCfg reply, established 002 "home" #2: initiating Quick Mode PUBKEY+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1} 112 "home" #2: STATE_QUICK_I1: initiate 002 "home" #2: sent QI2, IPsec SA established {ESP=>0xf48d5d32 <0xb000e5a9} 004 "home" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0xf48d5d32 <0xb000e5a9} carol# sleep 1 TEST carol# cat /var/log/auth.log | grep 'received IPv4 DNS server address 192.168.0.150' [YES] Feb 27 23:06:00 carol pluto[13499]: "home" #1: received IPv4 DNS server address 192.168.0.150 carol# cat /var/log/auth.log | grep 'received IPv4 DNS server address 10.1.0.20' [YES] Feb 27 23:06:00 carol pluto[13499]: "home" #1: received IPv4 DNS server address 10.1.0.20 carol# cat /var/log/auth.log | grep 'received IPv4 NBNS server address 10.1.0.20' [YES] Feb 27 23:06:00 carol pluto[13499]: "home" #1: received IPv4 NBNS server address 10.1.0.20 carol# cat /var/log/auth.log | grep 'setting virtual IP source address to 10.3.0.1' [YES] Feb 27 23:06:00 carol pluto[13499]: "home" #1: setting virtual IP source address to 10.3.0.1 carol# ip addr list dev eth0 | grep '10.3.0.1' [YES] inet 10.3.0.1/32 scope global eth0 carol# ip route list table 220 | grep '10.1.0.0/16.*src 10.3.0.1' [YES] 10.1.0.0/16 via 192.168.0.1 dev eth0 src 10.3.0.1 carol# ipsec status | grep 'home.*IPsec SA established' [YES] 000 #2: "home" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 943s; 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=13.4 ms dave# cat /var/log/auth.log | grep 'received IPv4 DNS server address 192.168.0.150' [YES] Feb 27 23:06:05 dave pluto[6397]: "home" #1: received IPv4 DNS server address 192.168.0.150 dave# cat /var/log/auth.log | grep 'received IPv4 DNS server address 10.1.0.20' [YES] Feb 27 23:06:05 dave pluto[6397]: "home" #1: received IPv4 DNS server address 10.1.0.20 dave# cat /var/log/auth.log | grep 'received IPv4 NBNS server address 10.1.0.20' [YES] Feb 27 23:06:05 dave pluto[6397]: "home" #1: received IPv4 NBNS server address 10.1.0.20 dave# cat /var/log/auth.log | grep 'setting virtual IP source address to 10.3.0.2' [YES] Feb 27 23:06:05 dave pluto[6397]: "home" #1: setting virtual IP source address to 10.3.0.2 dave# ip addr list dev eth0 | grep '10.3.0.2' [YES] inet 10.3.0.2/32 scope global eth0 dave# ip route list table 220 | grep '10.1.0.0/16.*src 10.3.0.2' [YES] 10.1.0.0/16 via 192.168.0.1 dev eth0 src 10.3.0.2 dave# ipsec status | grep 'home.*IPsec SA established' [YES] 000 #2: "home" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 946s; 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.760 ms moon# cat /var/log/auth.log | grep 'peer requested virtual IP %any' [YES] Feb 27 23:06:00 moon pluto[15954]: "rw"[2] 192.168.0.100 #1: peer requested virtual IP %any Feb 27 23:06:05 moon pluto[15954]: "rw"[4] 192.168.0.200 #3: peer requested virtual IP %any moon# cat /var/log/auth.log | grep 'acquired new lease for address.*in pool.*bigpool' [YES] Feb 27 23:06:00 moon pluto[15954]: acquired new lease for address 10.3.0.1 in pool 'bigpool' Feb 27 23:06:05 moon pluto[15954]: acquired new lease for address 10.3.0.2 in pool 'bigpool' moon# cat /var/log/auth.log | grep 'assigning virtual IP' [YES] Feb 27 23:06:00 moon pluto[15954]: "rw"[2] 192.168.0.100 #1: assigning virtual IP 10.3.0.1 to peer Feb 27 23:06:05 moon pluto[15954]: "rw"[4] 192.168.0.200 #3: assigning virtual IP 10.3.0.2 to peer moon# ipsec pool --status 2> /dev/null | grep 'dns servers: 192.168.0.150 10.1.0.20' [YES] dns servers: 192.168.0.150 10.1.0.20 moon# ipsec pool --status 2> /dev/null | grep 'nbns servers: 10.1.0.20' [YES] nbns servers: 10.1.0.20 moon# ipsec pool --status 2> /dev/null | grep 'bigpool.*10.3.0.1.*10.3.3.232.*static.*2' [YES] bigpool 10.3.0.1 10.3.3.232 static 1000 2 ( 0%) 2 ( 0%) moon# ipsec pool --leases --filter pool=bigpool,addr=10.3.0.1,id=carol@strongswan.org 2> /dev/null | grep 'online' [YES] bigpool 10.3.0.1 online Feb 27 23:06:00 2010 carol@strongswan.org moon# ipsec pool --leases --filter pool=bigpool,addr=10.3.0.2,id=dave@strongswan.org 2> /dev/null | grep 'online' [YES] bigpool 10.3.0.2 online Feb 27 23:06:05 2010 dave@strongswan.org moon# ipsec status | grep 'rw.*IPsec SA established' [YES] 000 #2: "rw"[2] 192.168.0.100 STATE_QUICK_R2 (IPsec SA established); EVENT_SA_EXPIRE in 1189s; newest IPSEC; eroute owner 000 #4: "rw"[4] 192.168.0.200 STATE_QUICK_R2 (IPsec SA established); EVENT_SA_EXPIRE in 1194s; newest IPSEC; eroute owner moon# killall tcpdump moon# cat /tmp/tcpdump.log | grep 'IP carol.strongswan.org > moon.strongswan.org: ESP' [YES] 23:06:10.258632 IP carol.strongswan.org > moon.strongswan.org: ESP(spi=0x624d26f6,seq=0x1), length 132 moon# cat /tmp/tcpdump.log | grep 'IP moon.strongswan.org > carol.strongswan.org: ESP' [YES] 23:06:10.270691 IP moon.strongswan.org > carol.strongswan.org: ESP(spi=0x07bfee53,seq=0x1), length 132 moon# cat /tmp/tcpdump.log | grep 'IP dave.strongswan.org > moon.strongswan.org: ESP' [YES] 23:06:11.848582 IP dave.strongswan.org > moon.strongswan.org: ESP(spi=0xf48d5d32,seq=0x1), length 132 moon# cat /tmp/tcpdump.log | grep 'IP moon.strongswan.org > dave.strongswan.org: ESP' [YES] 23:06:11.848853 IP moon.strongswan.org > dave.strongswan.org: ESP(spi=0xb000e5a9,seq=0x1), length 132 alice# killall tcpdump alice# cat /tmp/tcpdump.log | grep 'IP carol1.strongswan.org > alice.strongswan.org: ICMP echo request' [YES] 23:06:10.208306 IP carol1.strongswan.org > alice.strongswan.org: ICMP echo request, id 3893, seq 1, length 64 alice# cat /tmp/tcpdump.log | grep 'IP alice.strongswan.org > carol1.strongswan.org: ICMP echo reply' [YES] 23:06:10.209513 IP alice.strongswan.org > carol1.strongswan.org: ICMP echo reply, id 3893, seq 1, length 64 alice# cat /tmp/tcpdump.log | grep 'IP dave1.strongswan.org > alice.strongswan.org: ICMP echo request' [YES] 23:06:11.786378 IP dave1.strongswan.org > alice.strongswan.org: ICMP echo request, id 19225, seq 1, length 64 alice# cat /tmp/tcpdump.log | grep 'IP alice.strongswan.org > dave1.strongswan.org: ICMP echo reply' [YES] 23:06:11.786419 IP alice.strongswan.org > dave1.strongswan.org: ICMP echo reply, id 19225, seq 1, length 64 POST-TEST 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 moon# ipsec pool --del bigpool 2> /dev/null moon# ipsec pool --del dns 2> /dev/null deleted dns server 192.168.0.150 deleted dns server 10.1.0.20 moon# ipsec pool --del nbns 2> /dev/null deleted nbns server 10.1.0.20 moon# rm /etc/ipsec.d/ipsec.*