Troubleshooting Tip: Troubleshooting IPsec Site-to-Site Tunnel Connectivity (2024)

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.

Process responsible for 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.

Troubleshooting Tip: Troubleshooting IPsec Site-to-Site Tunnel Connectivity (1)

Scope

FortiGate.


Solution

Step 1: What type of tunnel have issues?

FortiOS supports:

  • Site-to-Site VPN.
  • Dial-Up VPN .

Step 2: Is Phase-2 Status 'UP'?

  • No (SA=0) - Continue to Step 3.
  • Yes (SA=1) - If traffic is not passing, - Jump to Step 6.
  • Flapping - SA is flapping between 'UP' and 'Down' state - Jump to Step 7.

How to identify if Phase 2 is 'UP' or 'Down':

Phase-2 status can be found from both GUI and Command Line.

From GUI:

When Phase2 is Down:

When Phase2 is UP:

Troubleshooting Tip: Troubleshooting IPsec Site-to-Site Tunnel Connectivity (2)

From CLI: Execute the command 'diagnose vpn tunnel list name <phase1-name>' <----- To view the phase1 status for a specific tunnel.

['diagnose vpn tunnel list' , can also be executed to view the phase2 status of all tunnels ].

When Phase2 is Down:

Troubleshooting Tip: Troubleshooting IPsec Site-to-Site Tunnel Connectivity (3)

When Phase2 is UP:

Troubleshooting Tip: Troubleshooting IPsec Site-to-Site Tunnel Connectivity (4)

Step 3: Is IKE Phase1 up:

  • No (State – 'Connecting') - Continue to Step 4.
  • Yes (State – 'Established') - Jump to Step 5.

Execute the command 'diagnose vpn ike gateway list name <phase1-name>' <----- To view the phase1 status for a specific tunnel.

['diagnose vpn tunnel list' , can also be executed to view the phase2 status of all tunnels ].

When Phase1 is Down:

When Phase1 is UP:

Troubleshooting Tip: Troubleshooting IPsec Site-to-Site Tunnel Connectivity (5)

Step 4: Analyze the IKE phase 1 messages on the responder for a solution. [Phase 1 not up].

Troubleshooting IKE Phase 1 problems is best handled by reviewing VPN status messages on the responder firewall.

The responder is the 'receiver' side of the VPN that is receiving the tunnel setup requests.

The initiator is the side of the VPN that sends the initial tunnel setup requests.

Checklist:

  1. Is there any other device upstream to the firewall.
  2. Is the VPN Gateway configured to use the correct outgoing interface.
  3. Is the remote IP configured correctly?
  4. Run packet capture on the outgoing interface and confirm it is possible to see traffic from the remote peer. If not,
  • Make sure if IKE traffic on port 500/4500 is allowed in the network device connected upstream

Packet capture can be run from CLI or GUI :

GUI:

CLI:

diagnose sniffer packet any 'host <remote-peer-ip> and port (500 or 4500)' 6 0 l, control + c to stop

  1. If it is possible to see traffic on port 500/4500, then follow the steps below to troubleshoot this issue:
  2. Run below commands(on receiver) to capture the IKE logs and initiate tunnel/traffic from the remote end.

diagnose debug console timestamp enable

diagnose debug application ike -1
diagnose debug enable

Note:

Try to run the packet capture and the logs at the same time.
If VDOMs is enabled, make sure to be in the VDOM context and then execute the above commands.

Step 5: Phase1 has established but Phase2 is down .

Checklist:

  1. Confirm if the Encryption and Hashing algorithms match on both receiver and initiator.
  2. Check if PFS is enabled, if yes, make sure the configuration is matched on both the units.
  3. Make sure, if the quick mode selectors (interesting traffic) is matching on both units.
  4. If Phase-2 is still not up, run the packet capture on port 500/4500 and run the below commands.

diagnose vpn ike gateway list (or diagnose vpn ike gateway list name <tunnel-name>)

diagnose debug console timestamp enable
diagnose debug application ike -1
diagnose debug enable

Note:

If VDOMs is enabled, make sure to be in the VDOM context and then execute the above commands.

Packet capture can be collected as show below:

Troubleshooting Tip: Troubleshooting IPsec Site-to-Site Tunnel Connectivity (6)

Step 6: Phase2 is up but traffic is not passing.

Once the tunnel is up, traffic will be encapsulated in 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 define below allows traffic between – 192.168.1.0/24 and 192.168.2.0/24.

Let's assume that the IP address of the PC having an issue is 10.10.100.100/24.
If this PC is trying to reach any host in 192.168.2.0/24 network, FortiGate will drop this traffic because the phase2 quick mode selector does not have this source network included in it.

2. Check the IPv4 policies and confirm:

  • If there is policy defined for this traffic flow.
  • If there are any source and destination addresses defined, make sure it is configured to allow this traffic flow.

3. If the issue still persists:

  • Enable packet capture for remote peer’s ip address and set protocol to 50(ESP).

Troubleshooting Tip: Troubleshooting IPsec Site-to-Site Tunnel Connectivity (7)

  • Open two SSH session and run the below commands:

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 other protocol numbers can used as well for example OSPF(89).

SSH Session 2:

diagnose vpn tunnel list (or # diagnose vpn tunnel list name <phase2_tunnel_name> )

Note:

If VDOMs is enabled, make sure it is not in the VDOM context and then execute the above command.

Make sure to collect packet capture and the logs mentioned above around the same and attach it to the Fortinet case updates.

Along with this information, attach network topology (if any).

With this information, TAC will try to decrypt the ESP traffic in Wireshark.

If the remote peer is FortiGate as well, take packet capture on this unit as well which will make sure that this unit received the encrypted traffic or if it was lost in the middle.

Step 7: Troubleshoot IPsec VPN that is flapping.

Checklist:

  1. Does the issue affect one VPN or all configured VPNs.
  • If all VPN tunnels are affected:
  • Check Internet connection.
  • Run the below command to find out errors/logs associated with firewall/interface.

diagnose debug crashlog read

diagnose sys top 2 50, control + c to stop (run for 5 iterations)

get system performance status

diagnose hardware sysinfo conserve

diagnose hardware deviceinfo nic <interface-name>

execute tac report

Note:

If VDOMs is enabled, make sure it is not in the Global context and then execute the above commands.

  • If only one tunnel is flapping :
  • Collect the 'VPN Events' log as shown below:
  • Was the VPN stable for a period of time and now it is going up and down?
  • Yes - Investigate for network or unit changes or if any new network equipment has been added to the environment. If so, confirm changes/additions are correct.
  • No, Collect logs and packet capture as mentioned on Step 4

Make sure to collect packet capture and all the logs mentioned above around the same and attach it to the Fortinet case updates.

Along with this information, attach network topology (if any). With this information, TAC will investigate this issue.

Step 8: Logs to be collected and attached to TAC case.

Checklist:

SSH Session 1:

diagnose debug console timestamp enable
diagnose debug application ike -1
diagnose debug enable

SSH Session 2:

diagnose debug crashlog read
diagnose sys top 2 50, control + c to stop (run for 5 iterations)
get system performance status
diagnose hardware sysinfo conserve
diagnose hardware deviceinfo nic <interface-name>
diagnose vpn ike gateway list
diagnose vpn tunnel list
execute tac report

First Packet capture - IKE Traffic on ports 500/4500.

Troubleshooting Tip: Troubleshooting IPsec Site-to-Site Tunnel Connectivity (8)

Second Packet capture - ESP Traffic Protocol 50.

Troubleshooting Tip: Troubleshooting IPsec Site-to-Site Tunnel Connectivity (9)

Troubleshooting Tip: Troubleshooting IPsec Site-to-Site Tunnel Connectivity (2024)

FAQs

How do I troubleshoot IPsec VPN connectivity issues? ›

Troubleshoot IPsec/VPN/Firewall Connections Last Updated May 2, 2023
  1. Verify that the peer IP address for your tunnel is correct. ...
  2. Verify that peer IP address is reachable from the router. ...
  3. Verify that the Preshare Key (PSK) is correct. ...
  4. Dead Peer Connections must be enabled. ...
  5. Use supported proposal/transform sets.
May 2, 2023

How to troubleshoot a site to site VPN? ›

Troubleshooting
  1. Are both devices online and connected to the registry? ...
  2. Is the subnet you're trying to reach advertised over VPN? ...
  3. Are any firewalls blocking this traffic on the network? ...
  4. Are there any problems reaching out to non-VPN peers? ...
  5. Are there routes configured on both sides that point to the remote subnets?
Jan 16, 2024

Which log file should be used when troubleshooting IPsec site to site VPN connection problems? ›

The firewall uses the following files in /log to trace the IPsec events:
  • strongswan. log : IPsec VPN service log.
  • charon. log : IPsec VPN charon (IKE daemon) log.
  • strongswan-monitor. log : IPsec daemon monitoring log.
  • dgd. log : Dead Gateway Detection (DGD) and VPN failover log.
Apr 10, 2024

How do you check for IPsec connection? ›

The easiest test for an IPsec tunnel is a ping from one client station behind the firewall to another on the opposite side. If that works, the tunnel is up and working properly.

Why is my VPN having trouble connecting? ›

Update the VPN app: Ensure that your VPN application is updated to the latest version, as outdated apps may lead to connectivity problems. Try a different network: If you're on Wi-Fi, try switching to cellular data, or vice versa, to see if the issue is related to a specific network.

What causes VPN tunnel failure? ›

When VPN tunnels fail, it means that there are firewall/antivirus software restrictions, network failure, VPN setting error, or the router firmware is too old. Based on the four types of VPN tunnel failure causes, we summarize 12 tested solutions.

What is the first thing to check when troubleshooting VPN problems? ›

If your VPN is not working or you are experiencing VPN disconnection issues, try the following troubleshooting tips:
  • Test your internet connection. ...
  • Check your VPN credentials. ...
  • Restart your VPN software. ...
  • Clear old VPN software from your device. ...
  • Check your VPN settings. ...
  • Keep your VPN up-to-date. ...
  • Reinstall the VPN app.

How do I troubleshoot Azure site to site VPN? ›

Troubleshooting steps
  1. Step 1: Check whether the on-premises VPN device is validated. ...
  2. Step 2: Verify the shared key. ...
  3. Step 3: Verify the VPN peer IPs. ...
  4. Step 4: Check UDR and NSGs on the gateway subnet. ...
  5. Step 5: Check the on-premises VPN device external interface address.
Jul 31, 2023

How to test site to site VPN connection in Azure? ›

Verify the VPN connection

On the Azure portal menu, select All resources or search for and select All resources from any page. Select your virtual network gateway. On the pane for your virtual network gateway, select Connections. You can see the status of each connection.

How do I check my IPSec tunnel log? ›

On the details page of the IPsec-VPN connection, find the tunnel that you want to view and click View Logs in the Actions column. You can view the logs of each tunnel of an IPsec-VPN connection in dual-tunnel mode.

How to configure IPSec site to site? ›

Configure IPSec VPN Tunnels (Site-to-Site)
  1. Create a Security Policy Rule.
  2. Track Rules Within a Rulebase.
  3. Enforce Security Rule Description, Tag, and Audit Comment.
  4. Move or Clone a Security Rule or Object to a Different Virtual System.
  5. Test Security Rules.

What ports for IPSec VPN site to site? ›

IPSec VPN is a layer 3 protocol that communicates over IP protocol 50, Encapsulating Security Payload (ESP). It might also require UDP port 500 for Internet Key Exchange (IKE) to manage encryption keys, and UDP port 4500 for IPSec NAT-Traversal (NAT-T).

How to configure IPSec tunnels? ›

Procedure
  1. Configure IP addresses and static routes for interfaces on. ...
  2. Create IPSec proposals on RouterA and RouterB. ...
  3. Configure IKE peers on RouterA and RouterB. ...
  4. Create IPSec profiles on RouterA and RouterB. ...
  5. Apply the IPSec profiles to IPSec tunnel interfaces on.
Aug 7, 2023

How to check IPSec tunnel status in Windows? ›

Open PowerShell and use the ipconfig command to check that the connection is present. Use the route command to check that a route exists for the IP address that is assigned to the client. Use the ping command to ping a host on the corporate subnet, to test connectivity.

How to configure IPSec VPN on router? ›

  1. Enter ASUS Router App and click [Settings] > [VPN] > [VPN Server] > enable [IPSec VPN] (default is off)
  2. Enter customized [Pre-Shared Key], and this key is used to provide connection for IPSec VPN client. ...
  3. Enter customized [Username], [Password], and then click [OK].
Dec 14, 2023

How do I clear my IPSec tunnel? ›

  1. Network. IPSec Tunnels. and select the tunnel you want to refresh or restart.
  2. In the row for that tunnel, under the Status column, click. Tunnel Info. .
  3. At the bottom of the Tunnel Info screen, click the action you want: Refresh. —Updates the onscreen statistics. Restart.

Top Articles
Latest Posts
Article information

Author: Nathanial Hackett

Last Updated:

Views: 5396

Rating: 4.1 / 5 (52 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Nathanial Hackett

Birthday: 1997-10-09

Address: Apt. 935 264 Abshire Canyon, South Nerissachester, NM 01800

Phone: +9752624861224

Job: Forward Technology Assistant

Hobby: Listening to music, Shopping, Vacation, Baton twirling, Flower arranging, Blacksmithing, Do it yourself

Introduction: My name is Nathanial Hackett, I am a lovely, curious, smiling, lively, thoughtful, courageous, lively person who loves writing and wants to share my knowledge and understanding with you.