Created on
02-18-2021
08:48 AM
Edited on
08-27-2025
11:21 AM
By
Stephen_G
Description
This article describes how to troubleshoot basic IPsec tunnel issues and understand how to collect data required by TAC to investigate the VPN issues.
The process responsible for the negotiating phase-1 and phase-2: 'IKE'. Use the following steps to assist with resolving a VPN tunnel that is not active or passing traffic.
Scope
FortiGate.
Solution
Step 1: What type of tunnel has issues.
FortiOS supports:
Step 2: Is Phase-2 Status 'UP':
How to identify if Phase 2 is 'Up' or 'Down':
Phase-2 status can be found from both the GUI and the command line.
From GUI:
When Phase2 is Down:
Execute the command 'diagnose vpn ike gateway list name <phase1-name>' <- To view the phase1 status for a specific tunnel.
The initiator is the side of the VPN that sends the initial tunnel setup requests.
Checklist:
Make sure that IKE traffic on port 500/4500 is allowed in the network device connected upstream.
Packet capture can be run from the CLI or the GUI:
GUI:
CLI:
diagnose sniffer packet any 'host <remote-peer-ip> and port (500 or 4500)' 6 0 l, control + c to stop
diagnose debug console timestamp enable
diagnose vpn ike log-filter dst-addr4 10.10.100.109 <----- 10.10.100.109 is the remote gateway.
Note:
Starting from v7.4.1, the 'diagnose vpn ike log-filter dst-addr4' command has been changed to 'diagnose vpn ike log filter rem-addr4'.
To display the list of filters, use a '?' after 'filter'.
diagnose vpn ike log filter ?
loc-addr4: IPv4 local gateway address range to filter by.
mloc-addr4: Multiple IPv4 local gateway address to filter by.
rem-addr4: IPv4 remote gateway address range to filter by.
mrem-addr4: Multiple IPv4 remote gateway address to filter by.
loc-addr6: IPv6 local gateway address range to filter by.
mloc-addr6: Multiple IPv6 local gateway address to filter by.
rem-addr6: IPv6 remote gateway address range to filter by.
mrem-addr6: Multiple IPv6 remote gateway addresses to filter by.
diagnose vpn ike log filter rem-addr4 10.10.100.109
diagnose debug application ike -1
diagnose debug application fnbamd -1
diagnose debug application eap_proxy -1
diagnose debug console timestamp enable
diagnose debug enable
Note:
Try to run the packet capture and the logs at the same time.
If VDOMs are enabled, make sure to be in the VDOM context and then execute the above commands.
If there are more active tunnels on VDOM, it is possible to reduce a possibly large debug output with the following command (FortiOS v7.4.x) and filter the debugged tunnel by name, for example:
diagnose vpn ike log filter name <name of tunnel>
Step 5: Phase1 has been established, but Phase2 is down.
Checklist:
diagnose vpn ike gateway list <----- Or diagnose vpn ike gateway list name <tunnel-name>.
diagnose vpn ike log-filter dst-addr4 10.10.100.109 <----- 10.10.100.109 is the remote gateway.
diagnose debug console timestamp enable
diagnose debug application eap_proxy -1
diagnose debug application ike -1
diagnose debug enable
Note:
If VDOMs are enabled, make sure to be in the VDOM context and then execute the above commands.
Packet capture can be collected as shown below:
Step 6: Phase2 is up, but traffic is not passing.
Once the tunnel is up, traffic will be encapsulated in the ESP (Encapsulating Security Payload) protocol and sent to the remote peer.
Checklist:
1. Make sure the quick mode selector defined in Phase2 is configured properly to allow the traffic flow, which is having the issue.
For example:
Phase 2, defined below, allows traffic between 192.168.1.0/24 and 192.168.2.0/24.
In cases where ping is used as the diagnostic tool to test connectivity between local and remote sites, it will fail despite having the required firewall policy, phase 2 selectors (if defined), and static routes/blackhole routes configured on the FortiGate. However, when running the debug flow, it will show that the traffic is leaving the correct tunnel interface and gateway.
Ping to the FortiGate interface and the remote WAN interface works. To resolve this, check the Windows firewall settings on the destination devices to see whether it is enabled. This is a default behavior on the Windows firewall. To allow ICMP requests for testing connectivity, refer to these articles:
If the issue persists:
SSH session 1:
diagnose debug console timestamp enable
diagnose debug flow filter addr <destination-IP>
diagnose debug flow filter proto <1 or 17 or 6> (optional) where 1=ICMP, 6 = TCP, 17 = UDP…
diagnose debug flow show iprope enable
diagnose debug flow trace start 1000
Note that other protocol numbers can be used as well, for example, OSPF(89).
SSH Session 2:
diagnose vpn tunnel list (diagnose vpn tunnel list name <phase2_tunnel_name> )
SSH Session 3:
To clear the session for the source and destination, use the following command:
diagnose sys session filter clear
diagnose sys session filter src<source-IP>
diagnose sys session clear
diagnose sys session filter clear
diagnose sys session filter dst <destination-IP>
diagnose sys session clear
Note:
If VDOMs are enabled, make sure not to be in the VDOM context, and then execute the command above.
Make sure to collect packet capture and the logs mentioned above around the same time and attach them to the Fortinet case updates.
Check whether the issue affects one VPN or all configured VPNs. If all VPN tunnels are affected:
diagnose debug crashlog read
diagnose sys top 2 50 <- Press Ctrl + C to stop (run for 5 iterations).
get system performance status
diagnose hardware sysinfo conserve
diagnose hardware deviceinfo nic <interface-name>
execute tac report
If only one tunnel is flapping, collect the 'VPN Events' log as shown below:
Make sure to collect packet captures and all the logs mentioned above around the same time and attach them to the Fortinet case updates.
diagnose debug console timestamp enable
diagnose vpn ike log-filter dst-addr4 /rem-addr4 x.x.x.x <-- x.x.x.x is the remote gateway IP address.
diagnose debug application ike -1
diagnose debug application fnbamd -1
diagnose debug enable
diagnose debug crashlog read
diagnose sys top 2 50 <- Press Ctrl + C to stop (run for 5 iterations).
get system performance status
diagnose hardware sysinfo conserve
diagnose hardware deviceinfo nic <interface-name>
diagnose vpn ipsec status
diagnose vpn ike errors
diagnose vpn ike gateway list
diagnose vpn tunnel list
execute tac report
Note:
Some ISPs block traffic on port 500 if no ESP packets are being received, forcing NAT-T under phase1 -> network.
An ISP can block ESP packets even if the tunnel is up, as it can filter traffic based on the protocol number even after the tunnel is established.
To flush the tunnel, run the following:
diagnose vpn tunnel flush <phase1-name>
diagnose vpn ike gateway clear name <phase1-name>
Or:
diagnose vpn tunnel flush <phase1-name>
diagnose vpn ike gateway flush name <phase1-name>
Related articles:
Technical Tip: How to configure VPN Site to Site between FortiGates (Using VPN Setup Wizard)
Troubleshooting Tip: IPsec VPNs tunnels
Technical Tip: Setting multiple DNS server for IPSec dial-up VPN
Technical Tip: NAT-traversal comparison between site-to-site and dial-up” dynamic” tunnels
Technical Tip: FortiGate Hub with multiple IPSec Dial-up phase1 using IKEv2 and PSK authentication
Technical Tip: How to configure multiple VPN tunnels from the same ISP to the same remote peer ISP.
Technical Tip: IPsec dial-up full tunnel with FortiClient
Technical Tip: Differences between Aggressive and Main mode in IPSec VPN configurations
Technical Tip: Dynamic routing (BGP) over IPsec tunnel
Technical Tip: OSPF with IPSec VPN for network redundancy
Technical Tip: Dynamic dial-up VPN with OSPF
Technical Tip: Fortinet Auto Discovery VPN (ADVPN)
Technical Tip: 'set net-device' new route-based IPsec logic
Technical Tip: Simple OCVPN deployment
Technical Tip: SD-WAN integration with OCVPN
Technical Tip: Configure IPsec VPN with SD-WAN
Technical Tip: SD-WAN with DDNS type IPsec
Technical Tip: SD-WAN primary and backup IPsec tunnel scenario
Troubleshooting Tip: IPsec VPN Phase 1 Process - Aggressive Mode
Technical Tip: How to configure IPsec VPN Tunnel using IKE v2
Technical Tip: Hard timeout for Dialup IPSEC VPN Tunnel
Technical Tip: IPsec VPN NAT-traversal
Technical Tip: Ensuring Compatibility in IPsec VPN Configuration
Troubleshooting Tip: IPsec VPN failure due to one way IKE (UDP 500) communication
Technical Tip: Using the IPSec auto-negotiate and keepalive options on IPsec VPN tunnel
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.