../../guestbin/prep.sh
rise #
 ifconfig ipsec1 create reqid 100
rise #
 ifconfig ipsec1 inet tunnel 198.18.1.12 198.18.1.15
rise #
 ifconfig ipsec1 inet 198.18.12.12/24 198.18.15.15
rise #
 ifconfig ipsec1
ipsec1: flags=1008051<UP,POINTOPOINT,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 1400
	options=0
	tunnel inet 198.18.1.12 --> 198.18.1.15
	inet 198.18.12.12 --> 198.18.15.15 netmask 0xffffff00
	groups: ipsec
	reqid: 100
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
rise #
 ../../guestbin/ipsec-kernel-state.sh
No SAD entries.
rise #
 ../../guestbin/ipsec-kernel-policy.sh
0.0.0.0/0[any] 0.0.0.0/0[any] any
	in ipsec
	esp/tunnel/198.18.1.15-198.18.1.12/unique:100
	spid=1 seq=3 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
::/0[any] ::/0[any] any
	in ipsec
	esp/tunnel/198.18.1.15-198.18.1.12/unique:100
	spid=3 seq=2 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
0.0.0.0/0[any] 0.0.0.0/0[any] any
	out ipsec
	esp/tunnel/198.18.1.12-198.18.1.15/unique:100
	spid=2 seq=1 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
::/0[any] ::/0[any] any
	out ipsec
	esp/tunnel/198.18.1.12-198.18.1.15/unique:100
	spid=4 seq=0 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
rise #
 echo 'add 198.18.1.12 198.18.1.15 esp 4523 -m tunnel -u 100 -E rijndael-cbc "45-----Key----23" -A hmac-sha1 "45------Hash------23" ;' | setkey -c
rise #
 echo 'add 198.18.1.15 198.18.1.12 esp 2345 -m tunnel -u 100 -E rijndael-cbc "23-----Key----45" -A hmac-sha1 "23------Hash------45" ;' | setkey -c
rise #
 ifconfig ipsec1
ipsec1: flags=1008051<UP,POINTOPOINT,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 1400
	options=0
	tunnel inet 198.18.1.12 --> 198.18.1.15
	inet 198.18.12.12 --> 198.18.15.15 netmask 0xffffff00
	groups: ipsec
	reqid: 100
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
rise #
 ../../guestbin/ipsec-kernel-state.sh
198.18.1.15 198.18.1.12
	esp mode=tunnel spi=SPISPI(0xSPISPI) reqid=100(0x00000064)
	E: aes-cbc  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
	A: hmac-sha1  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
	seq=0x00000000 replay=0 flags=0x00000040 state=mature 
	created: TIMESTAMP	current: TIMESTAMP
	diff: N(s)	hard: 0(s)	soft: 0(s)
	last:                     	hard: 0(s)	soft: 0(s)
	current: 0(bytes)	hard: 0(bytes)	soft: 0(bytes)
	allocated: 0	hard: 0	soft: 0
	sadb_seq=1 pid=PID refcnt=1
198.18.1.12 198.18.1.15
	esp mode=tunnel spi=SPISPI(0xSPISPI) reqid=100(0x00000064)
	E: aes-cbc  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
	A: hmac-sha1  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
	seq=0x00000000 replay=0 flags=0x00000040 state=mature 
	created: TIMESTAMP	current: TIMESTAMP
	diff: N(s)	hard: 0(s)	soft: 0(s)
	last:                     	hard: 0(s)	soft: 0(s)
	current: 0(bytes)	hard: 0(bytes)	soft: 0(bytes)
	allocated: 0	hard: 0	soft: 0
	sadb_seq=0 pid=PID refcnt=1
rise #
 ../../guestbin/ipsec-kernel-policy.sh
0.0.0.0/0[any] 0.0.0.0/0[any] any
	in ipsec
	esp/tunnel/198.18.1.15-198.18.1.12/unique:100
	spid=1 seq=3 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
::/0[any] ::/0[any] any
	in ipsec
	esp/tunnel/198.18.1.15-198.18.1.12/unique:100
	spid=3 seq=2 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
0.0.0.0/0[any] 0.0.0.0/0[any] any
	out ipsec
	esp/tunnel/198.18.1.12-198.18.1.15/unique:100
	spid=2 seq=1 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
::/0[any] ::/0[any] any
	out ipsec
	esp/tunnel/198.18.1.12-198.18.1.15/unique:100
	spid=4 seq=0 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
rise #
 sleep 10 # give broken ping a chance
rise #
 ../../guestbin/ping-once.sh --up -I 198.18.12.12 198.18.15.15
up
rise #
 ../../guestbin/ipsec-kernel-state.sh
198.18.1.15 198.18.1.12
	esp mode=tunnel spi=SPISPI(0xSPISPI) reqid=100(0x00000064)
	E: aes-cbc  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
	A: hmac-sha1  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
	seq=0x00000000 replay=0 flags=0x00000040 state=mature 
	created: TIMESTAMP	current: TIMESTAMP
	diff: N(s)	hard: 0(s)	soft: 0(s)
	last: TIMESTAMP	hard: 0(s)	soft: 0(s)
	current: 168(bytes)	hard: 0(bytes)	soft: 0(bytes)
	allocated: 2	hard: 0	soft: 0
	sadb_seq=1 pid=PID refcnt=1
198.18.1.12 198.18.1.15
	esp mode=tunnel spi=SPISPI(0xSPISPI) reqid=100(0x00000064)
	E: aes-cbc  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
	A: hmac-sha1  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
	seq=0x00000002 replay=0 flags=0x00000040 state=mature 
	created: TIMESTAMP	current: TIMESTAMP
	diff: N(s)	hard: 0(s)	soft: 0(s)
	last: TIMESTAMP	hard: 0(s)	soft: 0(s)
	current: 304(bytes)	hard: 0(bytes)	soft: 0(bytes)
	allocated: 2	hard: 0	soft: 0
	sadb_seq=0 pid=PID refcnt=1
rise #
 ../../guestbin/ipsec-kernel-policy.sh
0.0.0.0/0[any] 0.0.0.0/0[any] any
	in ipsec
	esp/tunnel/198.18.1.15-198.18.1.12/unique:100
	spid=1 seq=3 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
::/0[any] ::/0[any] any
	in ipsec
	esp/tunnel/198.18.1.15-198.18.1.12/unique:100
	spid=3 seq=2 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
0.0.0.0/0[any] 0.0.0.0/0[any] any
	out ipsec
	esp/tunnel/198.18.1.12-198.18.1.15/unique:100
	spid=2 seq=1 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
::/0[any] ::/0[any] any
	out ipsec
	esp/tunnel/198.18.1.12-198.18.1.15/unique:100
	spid=4 seq=0 pid=PID scope=ifnet ifname=ipsec1
	refcnt=1
rise #
 setkey -F
rise #
 ifconfig ipsec1 destroy
rise #
 
