# Tạo mới Public NAT

{% hint style="danger" %}
**Lưu ý quan trọng**

* *<mark style="color:blue;">NAT và VM đi qua NAT ra internet phải cùng subnet</mark>*

* *<mark style="color:blue;">Public interface của NAT được tạo tự động khi NAT được tạo thành công, người dùng có thể cấu hình public IP vào các gói</mark>* [*<mark style="color:blue;">bandwidth</mark>*](https://docs.vngcloud.vn/vng-cloud-document/v/vn/vserver/compute-hcm03-1a/network/bandwidth-hcm-03/dich-vu-datatransfers-bandwidth) *<mark style="color:blue;">đã mua (nếu có) để tăng băng thông cho NAT.</mark>*

* *<mark style="color:blue;">Mặc định, NAT được tạo ra sẽ được mở sẵn một số port thông dụng như DNS(53), HTTP(80), HTTPS(443), ICMP packets, cũng như một số port của tại VNG như 10092, 6443. Trong trường hợp khách hàng muốn chỉnh sửa thêm port thì có thể thao tác</mark>* [*<mark style="color:blue;">tại đây</mark>*](/vng-cloud-document/vn/vnetwork/public-nat-instance/them-xoa-nat-port.md)

* *<mark style="color:blue;">Trong trường hợp muốn phân giải DNS, người dùng phải đảm bảo</mark>* *<mark style="color:blue;">**route**</mark>* *<mark style="color:blue;">ở trên được cấu hình chính xác đi qua gateway NAT cho IP Resolver</mark>*
  {% endhint %}

* Người dùng login vào <https://hcm-3-vnetwork.console.vngcloud.vn/nat/list> với region = HCM

* Chọn menu “**Public NAT Instance**” tại thanh menu bên trái màn hình

* Chọn chức năng “**Create a Public NAT**”

* Nhập thông tin NAT theo yêu cầu gồm:
  * Tên NAT
  * Gói dịch vụ
  * VPC, Subnet

* Kiểm tra thông tin giá dịch vụ tại phần “**Summary**”

* Nhấn “**TẠO PUBLIC NAT**”

Khi NAT được tạo thành công, người dùng sẽ thấy NAT xuất hiện trên màn hình danh sách NAT.

Người dùng cần thực hiện bước cấu hình các VM nào sẽ đi qua NAT bằng cách sử dụng NAT IP gateway theo cú pháp của OS Linux

*`ip route add <internet_ip> via <nat_gateway_ip> dev <interface>`.*

* `<internet_ip>`: IP internet, ví dụ : 0.0.0.0/0 hoặc default
* `<nat_gateway_ip>`: IP gate way được cung cấp trên màn hình chi tiết thông tin NAT sau khi NAT được tạo thành công
* dev `<interface>`: Device private interface của VM kết nối với NAT

Dưới đây là ví dụ add route trên VM với OS Linux theo cú pháp ở trên:

*`ip route add 0.0.0.0/0 via 10.0.0.100 dev eth0`*

**Trong trường hợp đã tồn tại route ra internet thông qua một gateway IP khác thì người dùng phải phải remove route hiện tại và add route mới đến NAT gateway IP.**

*<mark style="color:purple;">Dưới đây là một ví dụ về route ra internet đã tồn tại qua một gateway IP khác trên OS Linux</mark>*

<figure><img src="/files/Lo4jW7lPQSMIqR40dA2B" alt=""><figcaption></figcaption></figure>

*<mark style="color:purple;">Sau khi xóa route đã tồn tại trên VM, add lại route ra internet qua NAT</mark>*

<figure><img src="/files/COI6UqpnNVC5IbKkL2uw" alt=""><figcaption></figcaption></figure>

*<mark style="color:purple;">Kết quả thành công như hình</mark>*

<figure><img src="/files/K1gFbhgzajAqumOKs2sf" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vngcloud.vn/vng-cloud-document/vn/vnetwork/public-nat-instance/tao-moi-public-nat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
