Adding a DNAT Rule
Scenarios
After a private NAT gateway is created, you can add DNAT rules to allow servers in your VPC to provide services accessible from an on-premises server or a remote VPC.
You can configure a DNAT rule for each port of a server. If multiple servers need to provide services accessible from an on-premises server or a remote VPC, you need to create multiple DNAT rules.
Prerequisites
A private NAT gateway has been created.
Procedure
- Log in to the management console.
- Click
in the upper left corner and select the desired region and project. - Under Network, click NAT Gateway.
The NAT gateway console is displayed.
- In the navigation pane on the left, choose NAT Gateway > Private NAT Gateway.
- On the displayed page, click the name of the private NAT gateway for which you want to add the DNAT rule.
- On the private NAT gateway details page, click the DNAT Rules tab.
- Click Add DNAT Rule.
You need to add security group rules to allow inbound or outbound traffic after you add a DNAT rule. Otherwise, the DNAT rule does not take effect.
- Set the parameters as prompted. For details, see Table 1.
Table 1 Parameter descriptions Parameter
Description
Port Type
The port type. You can select All ports or Specific port.
- All ports: If you select this option, a transit IP address is configured for your servers. Any requests on the transit IP address will be forwarded to your servers based on the IP address mapping.
- Specific port: The NAT gateway only forwards requests with a specific protocol and port on the transit IP address to the corresponding port of the target server.
Protocol
The protocol can be TCP or UDP. If you select All ports, this parameter is All by default.
This parameter is available if you select Specific port for Port Type.
Transit Subnet
A subnet that does not in the VPC selected when you create the private NAT gateway.
Transit IP Address
The transit IP address that is used to access an on-premises data center or a remote VPC.
You can select a transit IP address that either is not bound to any resource, has been bound to a DNAT rule with Port Type set to Specific port of the current private NAT gateway, or has been bound to an SNAT rule of the current private NAT gateway.
External port
The port of the transit IP address. The port number must range from 1 to 65535.
This parameter is available if you select Specific port for Port Type.
Instance Type
The type of the instance that provides services accessible from an on-premises server or a remote VPC.
- Server
- Virtual IP address
- Load balancer
NIC
The NIC of the server. This parameter is available if you set Instance Type to Server.
Internal Port
The port of the instance. The port number must range from 1 to 65535.
This parameter is available if you select Specific port for Port Type.
Description
Supplementary information about the DNAT rule. The description can contain up to 255 characters.
- After the configuration is complete, click OK. Once the rule is created, its status changes to Running.
Last Article: Managing DNAT Rules
Next Article: Viewing a DNAT Rule
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.