After creating a NAT gateway, you need to configure routing rules to direct the subnet traffic to the NAT gateway.
- Click Route Table in the left sidebar of VPC Console.
- In the route table list, click the route table ID/name associated with the subnet that needs to access the internet.
- Click + New routing policies.
- In the pop-up window that appears, enter the destination (the public IP range to be accessed), select NAT Gateway for Next Hop Type, and then select the created VPN gateway ID for Next Hop.
- After you click Create to complete the configuration, the traffic generated when the CVM in the subnet associated with the route table accesses the Internet will be directed to the NAT gateway.