A systematic guide to help you diagnose and resolve common IPsec-VPN connection issues.
1. Quick self-checklist (5-minute fixes)
Before diving into detailed logs, complete this checklist to rule out the most common configuration errors. Many issues can be resolved at this stage.
Network connectivity: Can your on-premises gateway device
pingthe public IP address of the Alibaba Cloud VPN gateway?Action: Use the
ping <VPN Gateway Public IP>command from your gateway device. If it fails, check your Internet connection and any intermediate network firewalls.
Firewall and security policies: Have you opened the necessary ports?
Action: Ensure your on-premises firewall and any security policies (like Alibaba Cloud security groups if applicable) allow both inbound and outbound traffic for UDP port 500 and UDP port 4500 (for NAT Traversal).
Pre-Shared Key (PSK) match: Are the PSKs identical on both ends?
Action: Carefully compare the PSK on your IPsec connection configuration and your on-premises gateway device. Be cautious of hidden spaces during copy and paste.
Customer gateway IP address: Is the IP address correct, especially if your gateway device is behind a NAT?
Action: In the Alibaba Cloud console, check the IP address of the user gateway associated with your IPsec connection.
If your gateway device has a public IP, this value must be that public IP.
If your gateway device is behind a NAT device, this value must be the public IP of the NAT device. An incorrect IP here is a common cause of "no response" errors.
Route configuration: Are the routes pointing to the VPN?
Action:
Alibaba Cloud: Check the VPC route table to ensure that traffic destined for your on-premises network is routed to the VPN gateway.
On-premises: Check your on-premises router to ensure traffic destined for the VPC CIDR block is routed through the IPsec tunnel.
2. Find error information
If the quick check doesn't solve the problem, you need to find the specific error code or log message to pinpoint the issue.
View error codes
You can use the error codes as direct clues for troubleshooting.
To get the latest error status, you can trigger a new negotiation. A simple method is to modify the IPsec connection, change the Effective Immediately setting, save it, and then change it back.
VPN gateways created before March 21, 2019, must be upgraded to view error codes.
Console
Check the error code in the Connection Status column of the target Tunnel.
For single-tunnel mode: Check the error code in the Connection Status column of the target IPsec Connection.
API
Call DiagnoseVpnConnections to get error codes.
View connection logs
For more detailed analysis, especially when no error code is displayed, you can view up to 180 days of IPsec-VPN logs and filter by a specific time range (minimum of 10 minutes).
Console
Click View Logs in the Actions column for the target tunnel.
For single-tunnel mode: Click View Logs in the Actions column of the target IPsec connection.
API
Call DescribeVpnConnectionLogs to get connection logs.
3. Find a solution that suits your situation
Find your specific issue below and refer to the recommended solution.
a. Phase 1 failed or timeout
This is the most common issue, indicating that the Alibaba Cloud VPN gateway is sending negotiation requests but receiving no reply from your on-premises gateway device.
Possible cause | How to check & fix |
1. Network Connectivity Failure | Check: From your on-premises gateway device, run Fix: If the packets are lost, there is a network issue between your data center and Alibaba Cloud. Check your Internet connection, ISP, and any intermediate firewalls. VPN Gateway does not support cross-border IPsec-VPN connections. For such scenarios, use Cloud Enterprise Network (CEN). |
2. Incorrect user gateway IP | Check: In the Alibaba Cloud console, verify the IP address of the user gateway. Fix: The IP must be the public IP your on-premises device uses to connect to the Internet. If your device is behind a NAT, this must be the NAT's public IP. Warning: Modifying the user gateway's IP requires creating a new user gateway and re-associating it with the IPsec connection, which causes a service interruption. |
3. on-premises firewall blocking packets | Check: Review the access control policies on your on-premises gateway device and any upstream firewalls. Fix: Ensure that UDP port 500 (for IKE) and UDP port 4500 (for NAT-T) are open for traffic to and from the Alibaba Cloud VPN gateway's public IP. |
4. IKE (Phase 1) policy mismatch | Check: Compare the IKE configuration on both sides. Fix: Ensure the following parameters are identical: - IKE version ( - Negotiation mode ( - Encryption algorithm (e.g., - Authentication algorithm (e.g., - DH group (e.g., - SA lifecycle (in seconds). While they can differ, it's highly recommended to keep them the same to avoid instability. |
5. on-premises device issue | Check: Examine the status and logs of your on-premises gateway device for any errors or unexpected restarts. see Fix: Ensure the device is functioning correctly and has IPsec services running. Examples: Configuration examples for on-premises gateway devices. Some devices requires data traffic to trigger IPsec protocol negotiation. Contact the vendor to learn how to trigger. |
6. Others |
b. Phase 2 failed or timeout
c. Phase 2 succeed, but have trouble
Reference: Error Code and Log Keyword
Use Ctrl+F(Win) or Cmd+F(Mac) to look up the same error code or the keyword of the log entry in the following table to find the corresponding solution.
Console-based error code | API-based error code
| Error message | Keyword of the log entry | Solution |
The peer does not match. | PeerMismatch | The packet received does not match the customer gateway information. |
|
|
The algorithm does not match. | AlgorithmMismatch | The encryption algorithm, authentication algorithm, or DH group parameter does not match. |
|
|
The encryption algorithm does not match. | EncryptionAlgorithmMismatch | The encryption algorithm of the IPsec-VPN connection does not match. |
|
|
The authentication algorithm does not match. | AuthenticationAlgorithmMismatch | The authentication algorithm of IKE does not match. |
|
|
The DH group does not match. | DhGroupMismatch | The Phase 1 DH group parameter of IKE does not match. |
|
|
The pre-shared key does not match. | PskMismatch | The pre-shared key does not match. |
|
|
PeerID does not match. | PeerIdMismatch | The on-premisesID or RemoteID parameter does not match or is incompatible. |
|
|
DPD payload sequence is incompatible. | DpdHashNotifyCompatibility | DPD payload sequence is incompatible. |
| In scenarios where the Dead Peer Detection (DPD) feature is enabled, the default payload sequence is |
DPD timed out. | DpdTimeout | DPD packets timed out. |
|
|
The IKE version does not match. | IkeVersionMismatch | The IKE version or negotiation mode does not match. |
|
|
The negotiation mode does not match. | NegotiationModeMismatch | The negotiation mode does not match. |
|
|
NAT-T does not match. | NatTMismatch | NAT traversal does not match. |
| Make sure that the IPsec-VPN connection and customer gateway device use the same NAT traversal setting. If the customer gateway device is a backend device of a NAT gateway, we recommend that you enable NAT traversal for the IPsec-VPN connection and customer gateway device. |
SA Lifetime does not match. | LifetimeMismatch | The Lifetime parameter does not match. |
| Make sure that the SA lifecycle (seconds) of the IPsec-VPN connection in the IKE configuration and IPsec configuration is the same as that of the customer gateway device. The IPsec-VPN connection and customer gateway device can use different SA lifecycle (seconds) values. However, to ensure the stability of the IPsec-VPN connection when customer gateway devices from different manufacturers are used, we recommend that you configure the IPsec-VPN connection and customer gateway device to use the same SA lifecycle (seconds) value. |
The security protocol does not match. | SecurityProtocolMismatch | The security protocol does not match. |
| Make sure that the customer gateway device uses Encapsulating Security Payload (ESP) as the security protocol. VPN Gateway supports only the ESP protocol for IPsec-VPN connections. Authentication Header (AH) is not supported. |
The encapsulation mode does not match. | EncapsulationModeMismatch | The encapsulation mode does not match. |
| Make sure that the encapsulation mode of the customer gateway device is set to tunneling. VPN Gateway supports only the tunneling mode for IPsec-VPN connections. The transmission mode is not supported. |
The algorithm is incompatible. | AlgorithmCompatibility | The algorithm is incompatible. | N/A | If the authentication algorithm in the IKE configuration and IPsec configuration of the IPsec-VPN connection and customer gateway device is incompatible, select another authentication algorithm, such as md5. |
Protected Data Flow does not match. | TrafficSelectorMismatch | The Protected Data Flows parameter does not match. |
|
|
PFS does not match. | PfsMismatch | The Phase 2 DH group parameter does not match. |
| Make sure that the IPsec-VPN connection and customer gateway device use the same Perfect Forward Secrecy (PFS) setting in the IPsec configuration.
We recommend that you enable PFS for the IPsec-VPN connection and customer gateway device. |
The commit bit does not match. | CommitMismatch | The commit bit does not match. | N/A | Make sure that commits are disabled for the customer gateway device. Commits can ensure that IPsec negotiations are complete before the protected data flows are transmitted. VPN Gateway does not support commits. |
The proposal does not match. | ProposalMismatch | The proposal does not match. |
|
|
Negotiation failed. | NegotiationFailed | Negotiation failed. |
| Reset the IPsec-VPN connection to trigger an IPsec negotiation. The system checks the negotiation configuration again. |
Phase 1 negotiations timed out. | Phase1NegotiationTimeout | Phase 1 packets cannot be received and negotiation timed out. |
|
|
Phase 2 negotiations timed out. | Phase2NegotiationTimeout | Phase 2 packets cannot be received and negotiation timed out. | N/A |
|
Response packets cannot be received from the peer. | NoResponse | The peer gateway does not respond. |
|
|
The delete packet is received from the peer. | ReceiveDeleteNotify | The delete packet from the peer is received. |
| If the IPsec-VPN connection receives a |
The reason for the negotiation exception is not found. | NoExceptionFound | The reason for the negotiation exception is not found. | N/A | The IPsec-VPN connection may not have started an IPsec negotiation. Reset the IPsec-VPN connection on the Alibaba Cloud side or customer gateway device. On the Alibaba Cloud side, you can change the value of the Effective Immediately parameter for the IPsec-VPN connection, save the change, and then set the Effective Immediately parameter to the original value to trigger an IPsec negotiation. Then, refresh the page and check the negotiation result. |
