You have bought a public NAT gateway and added SNAT and DNAT rules, but your servers cannot access the Internet or provide services accessible from the Internet. Whether the network configured with a public NAT gateway can connect to the Internet depends on the route table configuration, security group configuration, and firewall configuration. If any configuration problem occurs, the network connection will fail. This section describes the fault locating process after a public NAT gateway is configured.
The following fault causes are listed in descending order of occurrence probability.
If the fault persists after one possible cause is ruled out, move down the list to the other possible causes.
Possible Cause |
Solution |
---|---|
The route table is incorrectly configured. |
Add the default route or a route pointing to the public NAT gateway to the route table. For details, see Checking Whether Default Route Pointing to the Public NAT Gateway Is Configured in the Route Table. |
The ECS has an EIP bound. |
Unbind the EIP from the ECS. For details, see Checking Whether the ECS Has an EIP Bound. |
The security group rules are incorrectly configured. |
Configure ECS security group rules to allow traffic to and from the ECS. For details, see Checking Whether Security Group Rules Allow Traffic to and from the ECS Port. |
The firewall is incorrectly configured. |
Add firewall rules to allow traffic in and out of the subnet. For details, see Checking Whether Firewall Rules Allow Traffic in and out of the Subnet. |
The EIP bandwidth exceeds the threshold. |
Increase the EIP bandwidth by referring to Checking Whether the EIP Bandwidth Limit Has Been Exceeded. |
The service volume of the Public NAT gateway exceeds the upper limit. |
Increase the public NAT gateway specifications. For details, see Checking Whether the SNAT Connection Limit for the Public NAT Gateway Has Been Exceeded. |
The assign status is abnormal. |
Ensure that the public NAT gateway is running. For details, see Check Whether the Public NAT Gateway Status is Normal. |
The ECS port is not listened on. |
Enable the ECS port again. For details, see Checking ECS Ports. |
Parameter |
Description |
---|---|
Destination |
The destination CIDR block Set it to 0.0.0.0/0. |
Next Hop Type |
Set it to NAT gateway. |
Next Hop |
Set it to the ID of the public NAT gateway you purchased. |
Description |
(Optional) Supplementary information about the route Enter up to 255 characters. Angle brackets (< or >) are not allowed. |
Parameter |
Description |
---|---|
Destination |
The destination CIDR block |
Next Hop Type |
Set it to NAT gateway. |
Next Hop |
Set it to the ID of the public NAT gateway you purchased. |
Description |
(Optional) Supplementary information about the route Enter up to 255 characters. Angle brackets (< or >) are not allowed. |
Parameter |
Description |
Example Value |
---|---|---|
Name |
(Mandatory) The name of the route table Enter up to 64 characters. Only letters, digits, underscores (_), hyphens (-), and periods (.) are allowed. Spaces are not allowed. |
rtb-001 |
VPC |
(Mandatory) The VPC that the route table belongs to |
vpc-001 |
Description |
(Optional) Supplementary information about the route table Enter up to 255 characters. Angle brackets (< or >) are not allowed. |
N/A |
Route Settings |
Information about routes You can click Add Route to add more routes. Set Destination to 0.0.0.0/0, Next Hop Type to NAT gateway, and Next Hop to the public NAT gateway you purchased. |
N/A |
An Information dialog box is displayed, indicating that you can associate the route table with a subnet now or later.
The Associated Subnets tab is displayed.
If both SNAT and EIP are configured for an ECS, the EIP is preferentially used for data forwarding.
If both DNAT and EIP are configured for an ECS, the ECS will have two EIPs, one that is bound to the ECS and one that is associated with the DNAT rule. Incoming data will be forwarded by one of the two EIPs, which is determined by the client user. Outgoing data will be forwarded by the EIP bound to the ECS in priority. If the two EIPs are different, data forwarding will fail.
If the ECS has an EIP bound, perform the following steps to unbind the EIP.
For details about how to unbind an EIP from an ECS, see Unbinding an EIP from an ECS and Releasing the EIP.
On the Summary tab page of the security group, click Inbound Rules or Outbound Rules to add an inbound rule and outbound rule that allow traffic to and from the ECS port. For details about inbound and outbound rule parameters, see Adding a Security Group Rule.
Check whether the VPC subnet is associated with firewall rules. If yes, check the firewall rules.
The specific firewall name indicates that the association is successful.
If no, add such inbound and outbound rules, or disassociate the firewall from the subnet.
The default firewall rules deny all incoming and outgoing packets. After the firewall is disabled, the default rules still take effect.
If an EIP is bound to the public NAT gateway, the bandwidth is used to provide access traffic between the public network and the public NAT gateway.
If the network is disconnected, check whether the EIP bandwidth exceeds the limit.
For details about how to increase the bandwidth, see Modifying an EIP Bandwidth.
For details about how to increase the public NAT gateway specifications, see Modifying a Public NAT Gateway.
Ensure that ECS ports are in the LISTEN state. Table 5 lists the common TCP statuses.
Run the netstat -antp command to check whether the ECS port is in the LISTEN state.
If no, enable the ECS port.
Perform the following operations to check port communication:
If no, enable the ECS port.
TCP Status |
Description |
Scenario |
---|---|---|
LISTEN |
Listens for network connection requests from a remote TCP port. |
The TCP server is running. |
ESTABLISHED |
A connection has been set up. |
A TCP connection is properly set up. |
TIME-WAIT |
Waits until the remote TCP server receives the acknowledgement of the connection termination request. |
The TCP connection is terminated, and the session is closed in 1 minute. |
CLOSE-WAIT |
Waits for a connection termination request sent by a local user. |
A program fault resulted in an open socket. This state is displayed after the network is disconnected, indicating that a process is in an infinite loop or waiting for certain requirements to be met. To resolve this issue, restart the affected process. |
FIN-WAIT-2 |
Waits for the network disconnection request from a remote TCP server. |
The network has been disconnected and requires 12 minutes to automatically recover. |
SYN-SENT |
Waits for the matched network connection request after a network connection request is sent. |
The TCP connection request failed, which is generally caused by the delayed handling of high CPU usage on the server or by a DDoS attack. |
FIN-WAIT-1 |
Waits for the remote TCP disconnection request, or the acknowledgement for a previous disconnection request. |
If the network has been disconnected, this state may not automatically recover after 15 minutes. If the port remains occupied for a long period of time, restart the OS to resolve the issue. |