When a subnet is configured to access the public network through a NAT gateway, all traffic from the cloud servers within that subnet will typically use the NAT gateway for outbound connections to the internet. This setup allows multiple servers to share a single public IP address, enhancing security by hiding the private IP addresses of the individual servers.
However, if the cloud servers are also assigned elastic IPs, they have the capability to directly access the public network using these elastic IPs. An elastic IP is a static, public IPv4 address that can be dynamically allocated to a cloud server. When a server uses its elastic IP for outbound traffic, it bypasses the NAT gateway and communicates directly with the internet.
Example:
NAT Gateway Usage: If Server A in Subnet X sends a request to a website, the request is first routed through the NAT gateway associated with Subnet X. The NAT gateway then forwards the request to the internet using its own public IP address.
Elastic IP Usage: If Server B in the same Subnet X sends a request to the same website but uses its assigned elastic IP for the outbound connection, the request goes directly to the internet from Server B's elastic IP, bypassing the NAT gateway.
In summary, while the subnet is configured to use a NAT gateway for public network access, individual cloud servers can still use their elastic IPs to directly access the internet if desired.
For managing such configurations efficiently, especially in complex networking environments, services like Tencent Cloud’s Virtual Private Cloud (VPC) offer robust tools to set up and manage NAT gateways and elastic IPs seamlessly.