FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
jprokic
Staff
Staff
Article Id 349471
Description The article explains the limitations of terminating the IPsec VPN on the VIP address (when DNAT is used), why it cannot be done, and what alternatives exist.
Scope FortiGate,
Solution

The following scenario is described:

 

IPSEC_VIP.png

 

Two FortiGates from the diagram are establishing an IPsec VPN S2S tunnel. FortiGate2 is configured in a way that the IPsec tunnel terminates on the VIP address (DNAT).

 

In such a scenario, an IPsec tunnel is never established.

FortiGate2 drops the VPN traffic with the following IPsec debug command: 'invalid SPI XXXXX, IPsec SA just negotiated'.

 

The scenario described above is not supported due to the architecture of the FortiGate and how the packets are processed.

 

Explanation:

The pre-route hook runs the inbound IPsec SA match before DNAT. Since the destination IP address has not been translated, the ESP packet  IP doesn't match the IP associated with the SA, and the packet is dropped. The SA match failed.

 

Possible alternatives if DNAT is required:

  1. Secondary IP address configuration on the underlay interface for the IPsec
  2. Separate NAT router in front of the FortiGate.
  3. Two different VDOMs: one to perform NAT, and one to terminate the IPsec tunnel.