Troubleshooting Tip: IPsec VPN 'error 22:Invalid argument' message
| Description | This article provides guidance on troubleshooting Site-to-Site VPN connectivity issues when Phase1 is down and the message 'error 22:Invalid argument' is seen in the IKE debugs. |
| Scope | FortiGate. |
| Solution | In this scenario, a Site-to-Site VPN was configured with the following phase1 parameters:
config vpn ipsec phase1-interface set ike-version 2 oKNJ3QFvx7z3kv/2XgDjCjxRJIQkGRRPDpwKpd3N2HVOG7c6bV3obL1gSsa/d
The messages 'could not send IKE Packet' and 'error 22:Invalid argument' are observed when running the following debug commands:
diagnose vpn ike log filter rem-addr4 192.168.254.100 diagnose debug application ike -1 diagnose debug enable
ike V=root:0:VPNtoHQ:VPNtoHQ: created connection: 0x55a1e37350 3 172.25.183.180->192.168.254.100:500. 000000000002120220800000000000002A02200011802 000034010100050300000C0100000C800E0 0800300000802000005030000080300000C0300000804 000005000000080400000E02000034020100050300000 C0100000C800E0100030000080200000503 0000080300000C0300000804000005000000080400000 E0200002C030100040300000C01000014800E00800300 00080200000503000008040000050000000 80400000E0200002C040100040300000C01000014800E 010003000008020000060300000804000005000000080 400000E0200002805010004030000080100 001C03000008020000050300000804000005000000080 400000E0000002C060100040300000C0100001C800E01 00030000080200000503000008040000050 00000080400000E28000108000E0000E2115C2AD4F76A 5F67BAFEF43370E3BF3B0966D08910FC986FB09FCAFC3 1335FE564874A84C777270BCDB665ED3118 ike V=root:0:VPNtoHQ:8524: could not send IKE Packet(SA_INIT):172.25.183.180:500->192.168.254.100:500, len=672, vrf=0: error 22:Invalid argument ike 0:VPNtoHQ:8524: out 4A38670E61A78A52000000 00000000002120220800000000000002A0220001180200 0034010100050300000C0100000C800E0 0800300000802000005030000080300000C03000008040 00005000000080400000E02000034020100050300000C0 100000C800E0100030000080200000503 0000080300000C0300000804000005000000080400000E 0200002C030100040300000C01000014800E0080030000 080200000503000008040000050000000 80400000E0200002C040100040300000C01000014800E0 1000300000802000006030000080400000500000008040 0000E0200002805010004030000080100 001C030000080200000503000008040000050000000804 00000E0000002C060100040300000C0100001C800E0100 030000080200000503000008040000050 00000080400000E28000108000E0000E2115C2AD4F76A 5F67BAFEF43370E3BF3B0966D08910FC986FB09FCAFC3 1335FE564874A84C777270BCDB665ED3118 ike V=root:0:VPNtoHQ:8524: could not send IKE Packet(RETRANSMIT_SA_INIT):172.25.183.180:500->192.168.254.100:500, len=672, vrf=0: error 22:Invalid argument
This error occurs when there is a blackhole route to the IP address of the remote-gw configured in phase-1.
A blackhole route is a static route that silently discards traffic without notifying the source (unlike a reject route, which sends back an ICMP message). In FortiOS, blackhole routes are commonly used for:
But when misconfigured or too general, a blackhole route can interfere with VPN traffic, especially Phase 1 IKE negotiations.
get router info routing-table details 192.168.254.100 Routing table for VRF=0
show router static set dst 192.168.254.100 255.255.255.255 set blackhole enable set vrf 0 next
Removing the blackhole route fixes the issue.
config router static delete 5 end
Related articles: |
