/testing/guestbin/swan-prep --nokeys
Creating empty NSS database
road #
 echo "192.1.2.0/24"  >> /etc/ipsec.d/policies/private-or-clear
road #
 ipsec start
Redirecting to: [initsystem]
road #
 ../../guestbin/wait-until-pluto-started
road #
 ipsec auto --add road-east
"road-east": added IKEv2 connection
road #
 echo "initdone"
initdone
road #
 ipsec auto --up road-east
"road-east"[1] 192.1.2.23 #1: initiating IKEv2 connection to 192.1.2.23 using UDP
"road-east"[1] 192.1.2.23 #1: sent IKE_SA_INIT request to 192.1.2.23:UDP/500
"road-east"[1] 192.1.2.23 #1: processed IKE_SA_INIT response from 192.1.2.23:UDP/4500 {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=DH19}, initiating IKE_AUTH
"road-east"[1] 192.1.2.23 #1: sent IKE_AUTH request to 192.1.2.23:UDP/4500
"road-east"[1] 192.1.2.23 #1: initiator established IKE SA; authenticated peer using authby=secret and ID_FQDN '@east'
"road-east"[1] 192.1.2.23 #2: received INTERNAL_IP4_ADDRESS 10.0.10.1
"road-east"[1] 192.1.2.23 #2: initiator established Child SA using #1; IPsec tunnel [10.0.10.1/32===192.0.2.0/24] {ESPinUDP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATD=192.1.2.23:4500 DPD=passive}
road #
 ipsec whack --trafficstatus
#2: "road-east"[1] 192.1.2.23, type=ESP, add_time=1234567890, inBytes=0, outBytes=0, maxBytes=2^63B, id='@east', lease=10.0.10.1/32
road #
 # ping should succeed through tunnel
road #
 ../../guestbin/ping-once.sh --up -I 192.1.3.209 192.0.2.254
up
road #
 ipsec whack --trafficstatus
#2: "road-east"[1] 192.1.2.23, type=ESP, add_time=1234567890, inBytes=84, outBytes=84, maxBytes=2^63B, id='@east', lease=10.0.10.1/32
road #
 echo done
done
road #
 ../../guestbin/ipsec-kernel-state.sh
src 192.1.3.209 dst 192.1.2.23
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec esn
	aead rfc4106(gcm(aes)) 0xENCAUTHKEY 128
	encap type espinudp sport 4500 dport 4500 addr 0.0.0.0
	lastused YYYY-MM-DD HH:MM:SS
	anti-replay esn context:
	 seq-hi 0x0, seq 0xXX, oseq-hi 0x0, oseq 0xXX
	 replay_window 128, bitmap-length 4
	 00000000 00000000 00000000 XXXXXXXX 
src 192.1.2.23 dst 192.1.3.209
	proto esp spi 0xSPISPI reqid REQID mode tunnel
	replay-window 0 flag af-unspec esn
	aead rfc4106(gcm(aes)) 0xENCAUTHKEY 128
	encap type espinudp sport 4500 dport 4500 addr 0.0.0.0
	lastused YYYY-MM-DD HH:MM:SS
	anti-replay esn context:
	 seq-hi 0x0, seq 0xXX, oseq-hi 0x0, oseq 0xXX
	 replay_window 128, bitmap-length 4
	 00000000 00000000 00000000 XXXXXXXX 
road #
 ../../guestbin/ipsec-kernel-policy.sh
src 10.0.10.1/32 dst 192.0.2.0/24
	dir out priority PRIORITY ptype main
	tmpl src 192.1.3.209 dst 192.1.2.23
		proto esp reqid REQID mode tunnel
src 192.0.2.0/24 dst 10.0.10.1/32
	dir fwd priority PRIORITY ptype main
	tmpl src 192.1.2.23 dst 192.1.3.209
		proto esp reqid REQID mode tunnel
src 192.0.2.0/24 dst 10.0.10.1/32
	dir in priority PRIORITY ptype main
	tmpl src 192.1.2.23 dst 192.1.3.209
		proto esp reqid REQID mode tunnel
src 192.0.2.0/24 dst 192.1.3.209/32
	dir fwd priority PRIORITY ptype main
	tmpl src 192.1.2.23 dst 192.1.3.209
		proto esp reqid REQID mode tunnel
src 192.0.2.0/24 dst 192.1.3.209/32
	dir in priority PRIORITY ptype main
	tmpl src 192.1.2.23 dst 192.1.3.209
		proto esp reqid REQID mode tunnel
src 192.1.3.209/32 dst 192.0.2.0/24
	dir out priority PRIORITY ptype main
	tmpl src 192.1.3.209 dst 192.1.2.23
		proto esp reqid REQID mode tunnel
road #
 nft list ruleset
table inet ipsec-cat {
	chain postrouting {
		type filter hook postrouting priority srcnat; policy accept;
		ipsec out reqid REQID ip saddr 192.1.3.209 ip daddr 192.0.2.0/24 ip saddr set 10.0.10.1 notrack counter packets 1 bytes 84
	}
	chain prerouting {
		type filter hook prerouting priority dstnat; policy accept;
		ipsec in reqid REQID ip saddr 192.0.2.0/24 ip daddr 10.0.10.1 ip daddr set 192.1.3.209 notrack counter packets 1 bytes 84
	}
}
road #
 
