IPsec VPN Troubleshooting
IPsec VPN Troubleshooting
IPsec VPN Troubleshooting
This section contains tips to help you with some common challenges of IPsec VPNs.
A VPN connection has multiple stages that can be confirmed to ensure the connection is working
properly. It is easiest to see if the final stage is successful first since if it is successful the other stages
will be working properly. Otherwise, you will need to work back through the stages to see where the
problem is located.
When a VPN connection is properly established, traffic will flow from one end to the other as if both
ends were physically in the same place. If you can determine the connection is working properly then
any problems are likely problems with your applications.
On some FortiGate units, such as the FortiGate 94D, you cannot ping over the IPsec tunnel without
first setting a source-IP. In this scenario, you must assign an IP address to the virtual IPSEC VPN
interface. Anything sourced from the FortiGate going over the VPN will use this IP address.
If the egress/outgoing interface (determined by kernel route) has an IP address, then use the IP address
of the egress/outgoing interface. Otherwise, use the IP address of the first interface from the interface
list (that has an IP address).
The first diagnostic command worth running, in any IPsec VPN troubleshooting situation, is the
following:
diagnose vpn tunnel list
This command is very useful for gathering statistical data such as the number of packets encrypted
versus decrypted, the number of bytes sent versus received, the SPI identifier, etc. This kind of
information in the resulting output can make all the difference in determining the issue with the VPN.
Another appropriate diagnostic command worth trying is:
diagnose debug flow
This command will inform you of any lack of firewall policy, lack of forwarding route, and of policy
ordering issues.
The following is a list of such potential issues. Bear in mind that the troubleshooting suggestions below
are not exhaustive, and may not reflect your network topology.
The resulting output may indicate where the problem is occurring. When you are finished, disable the
diagnostics by using the following command:
diagnose debug reset
diagnose debug disable
This will provide you with clues as to any PSK or other proposal issues. If it is a PSK mismatch, you
should see something similar to the following output:
ike 0:TRX:322: PSK auth failed: probable pre-shared key mismatch
ike Negotiate SA Error:
The resulting output should include something similar to the following, where blue represents the
remote VPN device, and green represents the local FortiGate.
responder received SA_INIT msg
incoming proposal:
proposal id = 1:
protocol = IKEv2:
encapsulation = IKEv2/none
type=ENCR, val=AES_CBC (key_len = 256)
type=INTEGR, val=AUTH_HMAC_SHA_96
type=PRF, val=PRF_HMAC_SHA
type=DH_GROUP, val=1536.
proposal id = 2:
protocol = IKEv2:
encapsulation = IKEv2/none
type=ENCR, val=3DES_CBC
type=INTEGR, val=AUTH_HMAC_SHA_2_256_128
type=PRF, val=PRF_HMAC_SHA2_256
type=DH_GROUP, val=1536.
proposal id = 1:
protocol = IKEv2:
encapsulation = IKEv2/none
type=ENCR, val=AES_CBC (key_len = 128)
type=INTEGR, val=AUTH_HMAC_SHA_96
type=PRF, val=PRF_HMAC_SHA
type=DH_GROUP, val=1536.
Dialup connection
A dialup VPN connection has additional steps. To confirm that a VPN between a local network and a
dialup client has been configured correctly, at the dialup client, issue a ping command to test the
connection to the local network. The VPN tunnel initializes when the dialup client attempts to connect.
If the ping or traceroute fail, it indicates a connection problem between the two ends of the tunnel. This
may or may not indicate problems with the VPN tunnel, or dialup client. As with the LAN connection,
confirm the VPN tunnel is established by checking Monitor > IPsec Monitor.
4. Set the log-filter to the IP address of the remote computer (10.11.101.10). This filters out all
VPN connections except ones to the IP address we are concerned with. The command is
diagnose vpn ike log-filter dst-addr4 10.11.101.10.
5. Set up the commands to output the VPN handshaking. The commands are:
diagnose debug app ike 255
diagnose debug enable
6. Have the remote FortiGate initiate the VPN connection in the web-based manager by going
to VPN > IPsec Tunnels and selecting Bring up.
This makes the remote FortiGate the initiator and the local FortiGate becomes the responder.
Establishing the connection in this manner means the local FortiGate will have its configuration
information as well as the information the remote computer sends. Having both sets of
information locally makes it easier to troubleshoot your VPN connection.
7. Watch the screen for output, and after roughly 15 seconds enter the following CLI command to
stop the output.
diagnose debug disable
8. If needed, save the log file of this output to a file on your local computer. Saving the output to a
file can make it easier to search for a particular phrase, and is useful for comparisons.
Note the phrase “initiator: main mode is sending 1st message...” which shows
you the handshake between the ends of the tunnel is in progress. Initiator shows the remote unit is
sending the first message.