Edge NAT Gateway supports the Destination Network Address Translation (DNAT) feature. DNAT uses port mapping to map public IP addresses on an Edge NAT Gateway to Edge Node Service (ENS) instances. This enables ENS instances to provide services over the Internet.
Precautions
If your ENS instance is already assigned a static public IP address or attached to an Elastic IP address (EIP), do not add a DNAT entry for it. To add a DNAT entry, you must first detach the EIP from the instance or release its static public IP address.
A public IP address cannot be used for both an SNAT entry and a DNAT entry at the same time. If the call to the CreateForwardEntry API operation fails and the error message indicates that the IP address is occupied, check whether the IP address is already bound to an SNAT rule. Use an elastic IP address (EIP) that is not used by any SNAT entry when you create a DNAT entry.
The DNAT feature does not support simultaneous inbound and outbound traffic forwarding on the same port of the same public IP address. If your business scenario (for example, Wuying Cloud Phone requires traffic to flow in and out through a specific port) needs bidirectional communication on the same IP and port, we recommend that you attach an EIP directly to the ENS instance instead of using DNAT.
Prerequisites
You have created an Edge NAT Gateway and attached an EIP to it. For more information, see Create and manage Edge NAT Gateway instances.
Create a DNAT entry
-
Log in to the Edge Node Service (ENS) console.
In the left-side navigation pane, click NAT Gateways.
-
On the NAT Gateway list page, find the target Edge NAT Gateway instance, and in the Actions column, click Manage.
-
On the DNAT tab, click Create DNAT Entry.
-
On the Set DNAT page, configure the following parameters.
Configuration
Description
Entry Name
The name of the DNAT entry.
Public IP Address
Select the public IP address for Internet access. This IP address cannot be the same as the one used for an SNAT entry.
ENS Instance
Select the instance that will use the DNAT rule to communicate with the Internet. You can only select an ENS instance from the drop-down list.
Public Port
The external port or port range for port forwarding.
-
The port number must be between 1 and 65535.
-
To forward a port range, separate the start and end ports with a forward slash (/), for example,
10/20.
Private Port
The internal port or port range for port forwarding.
NoteThe number of ports in the public port range and the private port range must be the same.
Protocol Type
The protocol type for port forwarding. Supported protocols are TCP, UDP, and Any.
-
-
Click Create.
Delete a DNAT entry
If an ENS instance no longer needs to provide services over the Internet, you can delete its DNAT entry.
-
Log in to the Edge Node Service (ENS) console.
In the left-side navigation pane, click NAT Gateways.
-
On the NAT Gateway list page, find the target Edge NAT Gateway instance, and then in the Actions column, click Manage.
-
On the NAT Gateway details page, click the DNAT tab. Find the target DNAT entry and click Delete in the Actions column.
-
In the dialog box that appears, click OK.