Created on
02-15-2006
12:00 AM
Edited on
04-27-2025
11:07 PM
By
Anthony_E
Description |
This article describes a common VPN Event log seen on the FortiGate that states 'Received ESP packet with unknown SPI'. The following are examples of what an administrator may see when reviewing VPN Event Logs:
Administrators may also see the following when running IKE debugs (diag debug app ike -1) while these logs are occurring:
|
Scope |
IPsec on FortiGate. |
Solution |
The Security Parameter Index (SPI) is a value that is sent with every ESP packet and is used as a means of matching incoming ESP packets to the correct IPsec tunnel on the VPN endpoint. These SPIs are created when an IPsec tunnel is formed between two endpoints, and also these SPIs are recreated whenever the VPN tunnel Phase 2 Security Associations (SAs) are rekeyed, or when the tunnel is restarted.
On the FortiGate, the SPIs for each VPN tunnel (along with other information) can be found by running diagnose vpn tunnel list. For checking specific tunnels by name, use the command diagnose vpn tunnel list name <Name of IPsec Tunnel>:
There are two SPIs per IPsec tunnel. IPsec utilizes two separate encryption keys (one for sending/encryption, the other for receiving/decryption), and so there are also corresponding SPIs used for either matching incoming ESP packets (decryption) or for attaching to outgoing ESP packets (encryption). Notably, these keys are the same on both VPN endpoints, but are flipped in terms of their usage (i.e. an encryption key on one side is the decryption key for the other, and vice versa).
There may be various reasons why the FortiGate will generate a log message regarding an unknown SPI, but ultimately the root issue is that the FortiGate received an ESP packet whose SPI does not match any currently-active IPsec tunnel. The following are some examples of how this might occur:
- In some scenarios, it's possible that a random host on the Internet is simply sending ESP packets to the FortiGate's public IP, even if a VPN tunnel had not been established between this remote peer and the FortiGate beforehand.
As a side note, it is not possible to drop incoming ESP packets as an attempt to prevent the 'unknown SPI' log message from being generated.
The following Community KB article discusses why by default it is not possible to drop ESP packets using local-in policies, and why an administrator should expect to see the 'unknown SPI' message in the event that such a packet is received by the FortiGate, This behavior can be changed for more information review the next KB ARTICLE: Technical Tip: Difference in ESP and IKE packet handling of local-in policies
Related documents: Technical Tip: ESP Packets are not blocked by local-in policy Troubleshooting Tool: Using the FortiOS built-in packet sniffer |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.