Create NAT
Important
NAT and VM going through NAT to the internet must be on the same subnet
The NAT's public interface is created automatically when the NAT is successfully established. Users can configure the public IP addresses into purchased bandwidth packages (if available) to increase the bandwidth for the NAT.
NAT only connects to the internet through ports 53, 80, 443, and ICMP packets. If you need support for other requests, please contact the VNG Cloud hotline.
If DNS resolution is needed, users must ensure that the route above is correctly configured to go through the NAT gateway for the IP resolver.
Log in to https://hcm-3.console.vngcloud.vn/vserver/ with region set to HCM.
Select the "Public NAT Instance" menu from the top-left-hand menu bar.
Choose the "Create a Public NAT" function.
Enter the required NAT information, including:
NAT Name
Service Package
VPC, Subnet
Check the service pricing information in the "Summary" section.
Click "CREATE A PUBLIC NAT".
When the NAT is successfully created, it will appear on the NAT list. The user needs to configure which VMs will use NAT by specifying the NAT IP gateway, using the sample syntax for Linux.
ip route add <internet_ip> via <nat_gateway_ip> dev <interface>
.
In this context:
<internet_ip>
is the IP address of the destination on the internet.<nat_gateway_ip>
is the IP address of the NAT gateway.<interface>
is the network interface that will be used for this route.
Below is an example of adding a route on a VM with Linux OS using the syntax above:
ip route add 0.0.0.0/0 via 10.0.0.100 dev eth0
.
In case there is already an existing route to the internet through a different gateway IP, the user must remove the current route and add a new route to the NAT gateway IP.
Here is an example of an internet route that already exists through a different gateway IP on Linux OS
![](https://docs.vngcloud.vn/~gitbook/image?url=https%3A%2F%2F1985221522-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F7rE7M1L7GYcwQzNGd0aB%252Fuploads%252F02aGoFUBwk4aTxN1Gf2X%252Fimage.png%3Falt%3Dmedia%26token%3D952650d0-e496-43c0-8087-b1cd5d5cd115&width=768&dpr=4&quality=100&sign=d93d1ccb&sv=1)
After deleting the existing route on the VM, add the route to the internet through NAT.
![](https://docs.vngcloud.vn/~gitbook/image?url=https%3A%2F%2F1985221522-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F7rE7M1L7GYcwQzNGd0aB%252Fuploads%252F4sPdR0LbQ5Psfld7MFVq%252Fimage.png%3Falt%3Dmedia%26token%3D59751e76-9017-44cc-88c6-ff6564ab8124&width=768&dpr=4&quality=100&sign=5e68531f&sv=1)
The result is successful as shown in the screenshot.
![](https://docs.vngcloud.vn/~gitbook/image?url=https%3A%2F%2F1985221522-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F7rE7M1L7GYcwQzNGd0aB%252Fuploads%252F7GayUhseZFGlIDBwuLgy%252Fimage.png%3Falt%3Dmedia%26token%3D0cd811f8-cac3-4628-9832-637bd7d81ea0&width=768&dpr=4&quality=100&sign=3e92556a&sv=1)
Last updated