Example Custom Route in a VPC
A custom route in a VPC routes traffic originating from ECSs in a VPC to a specified ECS also in that VPC. A custom route in a VPC can be used in the following scenarios:
- When ECSs in a VPC need to access the Internet, add a custom route to enable the ECSs to access the Internet through the ECS that has an EIP bound. When adding the custom route, set Destination to the default value 0.0.0.0/0 and Next Hop to the private or virtual IP address of the ECS that has an EIP bound in the VPC.
- When ECSs in a VPC need to access the container network, add a route to enable the ECSs to access the container network through an ECS with the container network configured. When adding the custom route, set Destination to default value 0.0.0.0/0 or a network segment on the container network and Next Hop to the private or virtual IP address of the ECS with the container network configured in the VPC.
The destination of each route must be unique.
Accessing the Internet Through a Custom Route
Example scenario
There are two ECSs in a VPC, ECS1 and ECS2. ECS1 has an EIP bound, but ECS2 does not. You can add a custom route to enable ECS2 to access the Internet through ECS1.
Configuration
- Table 1 lists the example custom route configuration. The destination is default value 0.0.0.0/0, and the next hop is the ECS1 private or virtual IP address bound with an EIP.
- When you use a custom route to access the Internet, the destination can only be set to default value 0.0.0.0/0. It cannot be set to a specific public network segment.
- If the next hop is a virtual IP address, the virtual IP address must have an EIP bound. Otherwise, access to the Internet through this virtual IP address is not possible.
- Configure ECS1 as an SNAT server by following the instructions provided in Configuring an SNAT Server.
Accessing the Container Network on an ECS Through a Custom Route
Example scenario
There are two ECSs in a VPC, ECS1 and ECS2, and a container network has been configured for ECS1. If ECS2 needs to access the container network, you can add a custom route.
Configuration
- When adding the custom route, set Destination to default value 0.0.0.0/0 or a network segment on the container network and Next Hop to the private or virtual IP address of the ECS with the container network configured in the VPC.
Table 2 Custom route Destination
Next Hop
0.0.0.0/0
The private or virtual IP address of ECS1
- Configure ECS1 as an SNAT server by following the instructions provided in Configuring an SNAT Server.
Last Article: Route Table Overview
Next Article: Example Custom Route Outside a VPC
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.