west:~#
 TESTNAME=ikev2-07-biddown
west:~#
 source /testing/pluto/bin/westlocal.sh
west:~#
 export PLUTO_EVENT_RETRANSMIT_DELAY=3
west:~#
 export PLUTO_MAXIMUM_RETRANSMISSIONS_INITIAL=4
west:~#
 iptables -A INPUT -i eth1 -s 192.0.2.0/24 -j DROP
west:~#
 iptables -F OUTPUT
west:~#
 iptables -A OUTPUT -o eth1 -p udp --dport 500 -m recent --rcheck --hitcount 6 -j ACCEPT
west:~#
 iptables -A OUTPUT -o eth1 -p udp --dport 500 -m recent --set -j DROP
west:~#
 ipsec setup start
ipsec_setup: Starting Openswan IPsec VERSION
west:~#
 ipsec whack --whackrecord /var/tmp/ikev2.record
west:~#
 ipsec auto --add westnet--eastnet-ikev2
west:~#
 ipsec auto --status
000 using kernel interface: klips
000 interface ipsec0/eth1 192.1.2.45
000 %myid = (none)
000 debug none
000  
000 algorithm ESP encrypt: id=3, name=ESP_3DES, ivlen=64, keysizemin=192, keysizemax=192
000 algorithm ESP encrypt: id=12, name=ESP_AES, ivlen=128, keysizemin=128, keysizemax=256
000 algorithm ESP auth attr: id=1, name=AUTH_ALGORITHM_HMAC_MD5, keysizemin=128, keysizemax=128
000 algorithm ESP auth attr: id=2, name=AUTH_ALGORITHM_HMAC_SHA1, keysizemin=160, keysizemax=160
000 algorithm ESP auth attr: id=9, name=AUTH_ALGORITHM_AES_CBC, keysizemin=128, keysizemax=128
000  
000 algorithm IKE encrypt: id=3, name=OAKLEY_BLOWFISH_CBC, blocksize=8, keydeflen=128
000 algorithm IKE encrypt: id=5, name=OAKLEY_3DES_CBC, blocksize=8, keydeflen=192
000 algorithm IKE encrypt: id=7, name=OAKLEY_AES_CBC, blocksize=16, keydeflen=128
000 algorithm IKE encrypt: id=65004, name=OAKLEY_SERPENT_CBC, blocksize=16, keydeflen=128
000 algorithm IKE encrypt: id=65005, name=OAKLEY_TWOFISH_CBC, blocksize=16, keydeflen=128
000 algorithm IKE encrypt: id=65289, name=OAKLEY_TWOFISH_CBC_SSH, blocksize=16, keydeflen=128
000 algorithm IKE hash: id=1, name=OAKLEY_MD5, hashsize=16
000 algorithm IKE hash: id=2, name=OAKLEY_SHA1, hashsize=20
000 algorithm IKE hash: id=4, name=OAKLEY_SHA2_256, hashsize=32
000 algorithm IKE hash: id=6, name=OAKLEY_SHA2_512, hashsize=64
000 algorithm IKE dh group: id=2, name=OAKLEY_GROUP_MODP1024, bits=1024
000 algorithm IKE dh group: id=5, name=OAKLEY_GROUP_MODP1536, bits=1536
000 algorithm IKE dh group: id=14, name=OAKLEY_GROUP_MODP2048, bits=2048
000 algorithm IKE dh group: id=15, name=OAKLEY_GROUP_MODP3072, bits=3072
000 algorithm IKE dh group: id=16, name=OAKLEY_GROUP_MODP4096, bits=4096
000 algorithm IKE dh group: id=17, name=OAKLEY_GROUP_MODP6144, bits=6144
000 algorithm IKE dh group: id=18, name=OAKLEY_GROUP_MODP8192, bits=8192
000  
000 stats db_ops: {curr_cnt, total_cnt, maxsz} :context={0,0,0} trans={0,0,0} attrs={0,0,0} 
000  
000 "westnet--eastnet-ikev2": 192.0.1.0/24===192.1.2.45<192.1.2.45>[@west,S=C]...192.1.2.23<192.1.2.23>[@east,S=C]===192.0.2.0/24; unrouted; eroute owner: #0
000 "westnet--eastnet-ikev2":     myip=unset; hisip=unset;
000 "westnet--eastnet-ikev2":   ike_life: 3600s; ipsec_life: 28800s; rekey_margin: 540s; rekey_fuzz: 100%; keyingtries: 12
000 "westnet--eastnet-ikev2":   policy: RSASIG+ENCRYPT+TUNNEL+PFS+IKEv2ALLOW+IKEv2Init; prio: 24,24; interface: eth1; 
000 "westnet--eastnet-ikev2":   newest ISAKMP SA: #0; newest IPsec SA: #0; 
000  
000  
west:~#
 ipsec whack --debug-control --debug-controlmore 
west:~#
 /testing/pluto/bin/wait-until-pluto-started
west:~#
 echo done
done
west:~#
 ipsec whack --debug-whackwatch --name westnet--eastnet-ikev2 --initiate  
002 "westnet--eastnet-ikev2": extra debugging enabled for connection: whackwatch
002 "westnet--eastnet-ikev2" #1: extra debugging enabled for connection: none
002 "westnet--eastnet-ikev2" #1: extra debugging enabled for connection: none
002 "westnet--eastnet-ikev2" #1: initiating v2 parent SA
133 "westnet--eastnet-ikev2" #1: STATE_PARENT_I1: initiate
002 "westnet--eastnet-ikev2" #1: extra debugging enabled for connection: whackwatch
003 ERROR: "westnet--eastnet-ikev2" #1: sendto on eth1 to 192.1.2.23:500 failed in ikev2_parent_outI1_common. Errno 1: Operation not permitted
133 "westnet--eastnet-ikev2" #1: STATE_PARENT_I1: sent v2I1, expected v2R1
002 "westnet--eastnet-ikev2" #1: extra debugging enabled for connection: whackwatch
003 ERROR: "westnet--eastnet-ikev2" #1: sendto on eth1 to 192.1.2.23:500 failed in EVENT_v2_RETRANSMIT. Errno 1: Operation not permitted
002 "westnet--eastnet-ikev2" #1: extra debugging enabled for connection: whackwatch
003 ERROR: "westnet--eastnet-ikev2" #1: sendto on eth1 to 192.1.2.23:500 failed in EVENT_v2_RETRANSMIT. Errno 1: Operation not permitted
002 "westnet--eastnet-ikev2" #1: extra debugging enabled for connection: whackwatch
031 "westnet--eastnet-ikev2" #1: max number of retransmissions (2) reached STATE_PARENT_I1.  No response (or no acceptable response) to our first IKE message
000 "westnet--eastnet-ikev2" #1: starting keying attempt 2 of at most 12
002 "westnet--eastnet-ikev2" #2: extra debugging enabled for connection: none
002 "westnet--eastnet-ikev2" #2: initiating v2 parent SA to replace #1
133 "westnet--eastnet-ikev2" #2: STATE_PARENT_I1: initiate, replacing #1
002 "westnet--eastnet-ikev2" #1: extra debugging enabled for connection: whackwatch
002 "westnet--eastnet-ikev2" #2: extra debugging enabled for connection: whackwatch
003 ERROR: "westnet--eastnet-ikev2" #2: sendto on eth1 to 192.1.2.23:500 failed in ikev2_parent_outI1_common. Errno 1: Operation not permitted
133 "westnet--eastnet-ikev2" #2: STATE_PARENT_I1: sent v2I1, expected v2R1
002 "westnet--eastnet-ikev2" #2: extra debugging enabled for connection: whackwatch
003 ERROR: "westnet--eastnet-ikev2" #2: sendto on eth1 to 192.1.2.23:500 failed in EVENT_v2_RETRANSMIT. Errno 1: Operation not permitted
002 "westnet--eastnet-ikev2" #2: extra debugging enabled for connection: whackwatch
003 ERROR: "westnet--eastnet-ikev2" #2: sendto on eth1 to 192.1.2.23:500 failed in EVENT_v2_RETRANSMIT. Errno 1: Operation not permitted
002 "westnet--eastnet-ikev2" #2: extra debugging enabled for connection: whackwatch
031 "westnet--eastnet-ikev2" #2: max number of retransmissions (2) reached STATE_PARENT_I1.  No response (or no acceptable response) to our first IKE message
000 "westnet--eastnet-ikev2" #2: starting keying attempt 3 of at most 12
000 "westnet--eastnet-ikev2" #2: next attempt will be IKEv1
002 "westnet--eastnet-ikev2" #3: extra debugging enabled for connection: none
002 "westnet--eastnet-ikev2" #3: initiating Main Mode to replace #2
104 "westnet--eastnet-ikev2" #3: STATE_MAIN_I1: initiate, replacing #2
002 "westnet--eastnet-ikev2" #2: extra debugging enabled for connection: whackwatch
002 "westnet--eastnet-ikev2" #3: extra debugging enabled for connection: whackwatch
003 "westnet--eastnet-ikev2" #3: received Vendor ID payload [Openswan 
003 "westnet--eastnet-ikev2" #3: received Vendor ID payload [Dead Peer Detection]
002 "westnet--eastnet-ikev2" #3: extra debugging enabled for connection: whackwatch
106 "westnet--eastnet-ikev2" #3: STATE_MAIN_I2: sent MI2, expecting MR2
002 "westnet--eastnet-ikev2" #3: extra debugging enabled for connection: whackwatch
002 "westnet--eastnet-ikev2" #3: extra debugging enabled for connection: whackwatch
108 "westnet--eastnet-ikev2" #3: STATE_MAIN_I3: sent MI3, expecting MR3
002 "westnet--eastnet-ikev2" #3: extra debugging enabled for connection: whackwatch
003 "westnet--eastnet-ikev2" #3: received Vendor ID payload [CAN-IKEv2]
002 "westnet--eastnet-ikev2" #3: Main mode peer ID is ID_FQDN: '@east'
002 "westnet--eastnet-ikev2" #3: Bid-down to IKEv1 attack detected, attempting to rekey connection with IKEv2
004 "westnet--eastnet-ikev2" #3: STATE_MAIN_I4: ISAKMP SA established {auth=OAKLEY_RSA_SIG cipher=aes_128 prf=oakley_sha group=modp1536}
002 "westnet--eastnet-ikev2" #3: extra debugging enabled for connection: whackwatch
002 "westnet--eastnet-ikev2" #4: extra debugging enabled for connection: none
002 "westnet--eastnet-ikev2" #4: initiating v2 parent SA to replace #3
133 "westnet--eastnet-ikev2" #4: STATE_PARENT_I1: initiate, replacing #3
002 "westnet--eastnet-ikev2" #3: extra debugging enabled for connection: whackwatch
002 "westnet--eastnet-ikev2" #3: ISAKMP SA expired (LATEST!)
002 "westnet--eastnet-ikev2" #3: extra debugging enabled for connection: none
002 "westnet--eastnet-ikev2" #4: extra debugging enabled for connection: whackwatch
133 "westnet--eastnet-ikev2" #4: STATE_PARENT_I1: sent v2I1, expected v2R1
002 "westnet--eastnet-ikev2" #4: extra debugging enabled for connection: whackwatch
134 "westnet--eastnet-ikev2" #5: STATE_PARENT_I2: sent v2I2, expected v2R2 {auth=IKEv2 cipher=aes_128 integ=sha1 prf=oakley_sha group=modp1536}
002 "westnet--eastnet-ikev2" #5: negotiated tunnel [192.0.1.0,192.0.1.255] -> [192.0.2.0,192.0.2.255]
004 "westnet--eastnet-ikev2" #5: STATE_PARENT_I3: PARENT SA established tunnel mode
west:~#
 ipsec look
west NOW
192.0.1.0/24       -> 192.0.2.0/24       => tun0xIPIP@192.1.2.23 esp0xESPSPI@192.1.2.23
ipsec0->eth1 mtu=16260(9999)->1500
tun0xTUN#@192.1.2.23 IPIP: dir=out src=192.1.2.45 natencap=none natsport=0 natdport=0  
esp0xKLIPSPIK@192.1.2.23 ESP_AES_HMAC_SHA1: dir=out src=192.1.2.45 iv_bits=128bits iv=0xIVISFORRANDOM000IVISFORRANDOM000 ooowin=64 alen=160 aklen=160 eklen=128 natencap=none natsport=0 natdport=0  
esp0xKLIPSPIK@192.1.2.45 ESP_AES_HMAC_SHA1: dir=in  src=192.1.2.23 iv_bits=128bits iv=0xIVISFORRANDOM000IVISFORRANDOM000 ooowin=64 alen=160 aklen=160 eklen=128 natencap=none natsport=0 natdport=0  
tun0xTUN#@192.1.2.45 IPIP: dir=in  src=192.1.2.23 policy=192.0.2.0/24->192.0.1.0/24 flags=0x8<> natencap=none natsport=0 natdport=0  
ROUTING TABLE
192.1.2.0/24 dev eth1  proto kernel  scope link  src 192.1.2.45 
192.1.2.0/24 dev ipsec0  proto kernel  scope link  src 192.1.2.45 
192.0.2.0/24 dev ipsec0  scope link 
default via 192.1.2.254 dev eth1 
west:~#
 echo done
done
west:~#
 

west:~#
west:~#
 if [ -f /tmp/core ]; then echo CORE FOUND; mv /tmp/core /var/tmp; fi
west:~#

