All Products
Search
Document Center

ENS:Create and manage DNAT entries

Last Updated:Jun 23, 2026

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

  1. Log in to the Edge Node Service (ENS) console.

  2. In the left-side navigation pane, click NAT Gateways.

  3. On the NAT Gateway list page, find the target Edge NAT Gateway instance, and in the Actions column, click Manage.

  4. On the DNAT tab, click Create DNAT Entry.

  5. 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.

    Note

    The 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.

  6. 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.

  1. Log in to the Edge Node Service (ENS) console.

  2. In the left-side navigation pane, click NAT Gateways.

  3. On the NAT Gateway list page, find the target Edge NAT Gateway instance, and then in the Actions column, click Manage.

  4. On the NAT Gateway details page, click the DNAT tab. Find the target DNAT entry and click Delete in the Actions column.

  5. In the dialog box that appears, click OK.

FAQ

When I create a DNAT entry, why can't I find my created EIP in the public IP address list?

Before you create a DNAT entry, make sure that you have created a NAT Gateway and attached an EIP to it.

If an ENS instance is attached to an EIP, can I create a DNAT entry for it?

Adding a DNAT entry for this ENS instance is not recommended.

You must detach the EIP from an ENS instance before you can create a DNAT entry for it.

Why can't my ENS instance be accessed from the Internet after I configured a DNAT entry for it?

If an ENS instance with a configured DNAT entry is inaccessible from the public network, it may be for one of the following reasons:

  • The security group rules of the ENS instance do not allow public network access to the private port specified in the DNAT entry. Check the security group rules of the instance. If a rule that allows access to the private port does not exist, add one.

  • The route table does not have a custom route entry with the destination CIDR block set to 0.0.0.0/0 and the next hop set to the NAT Gateway.

    When an ENS instance sends a response message, a route to the NAT Gateway is required. Check the system route table or the custom route table for this route entry. If the route entry does not exist, you must add it manually.