/testing/guestbin/swan-prep --userland strongswan
north #
 # delete the address .34 before re-run. otherwise strongswan may choose .34
north #
 ip addr show dev eth1 | grep 192.1.3.34 && ip addr del 192.1.3.34/24 dev eth1
north #
 # add .33 incase re-run
north #
 ip addr show dev eth1 | grep 192.1.3.33 || ip addr add 192.1.3.33/24 dev eth1
    inet 192.1.3.33/24 brd 192.1.3.255 scope global eth1
north #
 # add default gw, it could have been deleted due address changes
north #
 ip route | grep default || ip route add default via 192.1.3.254
default via 192.1.3.254 dev eth1 
north #
 ip addr add 192.1.3.34/24 dev eth1
north #
 ../../pluto/bin/strongswan-start.sh
north #
 echo "initdone"
initdone
north #
 strongswan up westnet-eastnet-ikev2
initiating IKE_SA westnet-eastnet-ikev2[1] to 192.1.2.23
generating IKE_SA_INIT request 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) N(FRAG_SUP) N(HASH_ALG) N(REDIR_SUP) ]
sending packet: from 192.1.3.33[500] to 192.1.2.23[500] (XXX bytes)
received packet: from 192.1.2.23[500] to 192.1.3.33[500] (XXX bytes)
parsed IKE_SA_INIT response 0 [ SA KE No N(FRAG_SUP) N(NATD_S_IP) N(NATD_D_IP) ]
authentication of 'north' (myself) with pre-shared key
establishing CHILD_SA westnet-eastnet-ikev2{1}
generating IKE_AUTH request 1 [ IDi N(INIT_CONTACT) IDr AUTH SA TSi TSr N(MOBIKE_SUP) N(ADD_4_ADDR) N(ADD_4_ADDR) N(EAP_ONLY) N(MSG_ID_SYN_SUP) ]
sending packet: from 192.1.3.33[4500] to 192.1.2.23[4500] (XXX bytes)
received packet: from 192.1.2.23[4500] to 192.1.3.33[4500] (XXX bytes)
parsed IKE_AUTH response 1 [ N(MOBIKE_SUP) IDr AUTH SA TSi TSr ]
authentication of 'east' with pre-shared key successful
IKE_SA westnet-eastnet-ikev2[1] established between 192.1.3.33[north]...192.1.2.23[east]
scheduling reauthentication in XXXs
maximum IKE_SA lifetime XXXs
CHILD_SA westnet-eastnet-ikev2{1} established with SPIs SPISPI_i SPISPI_o and TS 192.0.3.0/24 === 192.0.2.0/24
connection 'westnet-eastnet-ikev2' established successfully
north #
 ping -W 1 -q -n -c 2 -I 192.0.3.254 192.0.2.254
PING 192.0.2.254 (192.0.2.254) from 192.0.3.254 : 56(84) bytes of data.
--- 192.0.2.254 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time XXXX
rtt min/avg/max/mdev = 0.XXX/0.XXX/0.XXX/0.XXX ms
north #
 strongswan status
Security Associations (1 up, 0 connecting):
westnet-eastnet-ikev2[1]: ESTABLISHED XXX second ago, 192.1.3.33[north]...192.1.2.23[east]
westnet-eastnet-ikev2{1}:  INSTALLED, TUNNEL, reqid 1, ESP SPIs: SPISPI_i SPISPI_o
westnet-eastnet-ikev2{1}:   192.0.3.0/24 === 192.0.2.0/24
north #
 # note this end is 192.1.3.33
north #
 ip xfrm state
src 192.1.3.33 dst 192.1.2.23
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	enc cbc(aes) 0xKEY
src 192.1.2.23 dst 192.1.3.33
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	enc cbc(aes) 0xKEY
north #
 ip xfrm pol
src 192.0.3.0/24 dst 192.0.2.0/24 
	dir out priority 375423 ptype main 
	tmpl src 192.1.3.33 dst 192.1.2.23
		proto esp spi 0xSPISPI reqid 1 mode tunnel
src 192.0.2.0/24 dst 192.0.3.0/24 
	dir fwd priority 375423 ptype main 
	tmpl src 192.1.2.23 dst 192.1.3.33
src 192.0.2.0/24 dst 192.0.3.0/24 
	dir in priority 375423 ptype main 
	tmpl src 192.1.2.23 dst 192.1.3.33
north #
 sleep 5
north #
 # remove this end ip next one will take over
north #
 ip addr del 192.1.3.33/24 dev eth1
north #
 # let strongswan do a MOBIKE update
north #
 sleep 10
north #
 # both ends updated MOBIKE ping should work
north #
 # note this end should be 192.1.3.34
north #
 strongswan status
Security Associations (1 up, 0 connecting):
westnet-eastnet-ikev2[1]: ESTABLISHED XXX second ago, 192.1.3.34[north]...192.1.2.23[east]
westnet-eastnet-ikev2{1}:  INSTALLED, TUNNEL, reqid 1, ESP SPIs: SPISPI_i SPISPI_o
westnet-eastnet-ikev2{1}:   192.0.3.0/24 === 192.0.2.0/24
north #
 ping -W 1 -q -n -c 2 -I 192.0.3.254 192.0.2.254
PING 192.0.2.254 (192.0.2.254) from 192.0.3.254 : 56(84) bytes of data.
--- 192.0.2.254 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time XXXX
rtt min/avg/max/mdev = 0.XXX/0.XXX/0.XXX/0.XXX ms
north #
 echo done
done
north #
 ../../pluto/bin/ipsec-look.sh
north NOW
XFRM state:
src 192.1.3.34 dst 192.1.2.23
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	enc cbc(aes) 0xKEY
src 192.1.2.23 dst 192.1.3.34
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	enc cbc(aes) 0xKEY
XFRM policy:
src 192.0.2.0/24 dst 192.0.3.0/24
	dir fwd priority 375423 ptype main
	tmpl src 192.1.2.23 dst 192.1.3.34
src 192.0.2.0/24 dst 192.0.3.0/24
	dir in priority 375423 ptype main
	tmpl src 192.1.2.23 dst 192.1.3.34
src 192.0.3.0/24 dst 192.0.2.0/24
	dir out priority 375423 ptype main
	tmpl src 192.1.3.34 dst 192.1.2.23
		proto esp spi 0xSPISPI reqid REQID mode tunnel
XFRM done
IPSEC mangle TABLES
NEW_IPSEC_CONN mangle TABLES
ROUTING TABLES
default via 192.1.3.254 dev eth1 
192.0.1.0/24 via 192.1.3.254 dev eth1 
192.0.2.0/24 via 192.1.3.254 dev eth1 
192.0.3.0/24 dev eth0 proto kernel scope link src 192.0.3.254 
192.1.2.0/24 via 192.1.3.254 dev eth1 
192.1.3.0/24 dev eth1 proto kernel scope link src 192.1.3.34 
NSS_CERTIFICATES
Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI
north #
 if [ -f /var/run/pluto/pluto.pid ]; then ipsec whack --trafficstatus ; fi
north #
 if [ -f /var/run/charon.pid ]; then strongswan status ; fi
Security Associations (1 up, 0 connecting):
westnet-eastnet-ikev2[1]: ESTABLISHED XXX second ago, 192.1.3.34[north]...192.1.2.23[east]
westnet-eastnet-ikev2{1}:  INSTALLED, TUNNEL, reqid 1, ESP SPIs: SPISPI_i SPISPI_o
westnet-eastnet-ikev2{1}:   192.0.3.0/24 === 192.0.2.0/24
north #
north #
 ../bin/check-for-core.sh
north #
 if [ -f /sbin/ausearch ]; then ausearch -r -m avc -ts recent ; fi

