Skip to main content

Routing Table

A routing table is used to manage traffic paths within a VPC. When a routing table is created, related routers are internally created, and each subnet is connected to a specific router within the VPC. As a result, the routing table determines which router will route the traffic based on the paths maintained internally. Therefore, an efficient routing table setup is crucial for directing traffic in the desired direction within the VPC.

By creating a routing table, you can set the appropriate routing for the packets of each subnet or associate the routing with the desired subnet. Every VPC has one routing table created by default, referred to as the default routing table. The default routing table is marked as Yes in the KakaoCloud Console > VPC > Routing Table menu.

The default routing table cannot be deleted and will be deleted along with the VPC when it is deleted.

info

For more details about routing table quotas, refer to Service Pricing and Quotas.

Types of route tables

Main route table

When a default VPC is created, a Main routing table is automatically generated. When a new subnet is created, if no specific routing table is configured, all subnets will be associated with the default routing table. In the KakaoCloud Console's VPC service menu, the default routing table is marked as Yes in the default column. The default routing table follows these rules:

  • The default subnet created when the default VPC is generated is associated with the default routing table.
  • The default routing table cannot be deleted.
  • You can add, remove, and modify routes in the default routing table.
  • Any subnet can change its associated routing table.
  • You can change a regular routing table to the default routing table. After changing the default routing table, newly added subnets will be associated with the changed default routing table.

Custom route table

Users can freely create routing tables and add routes as needed. After creating a new subnet and a new routing table, you can associate them. This allows for isolated and controlled traffic routing for each subnet.
In other words, each subnet can have its own routing table, and users can adjust the flow of traffic and choose the optimal path based on the destination. However, when deleting a routing table, it's important to note that since the routing table is closely related to the associated subnets, you must first disassociate all subnets connected to the routing table before deleting it.

Configuration of route table

Each routing table consists of routes that specify destinations and targets. A local route for internal VPC communication is automatically added to every routing table, which is included by default in all routing tables. The following rules apply:

  • You can add more specific routes to the routing table than the local route.
  • The destination must match the entire IPv4 CIDR block of the subnet within the VPC, and the target can be a gateway, network interface, etc.
  • If there are multiple routes in the routing table, the most specific route (longest prefix match) is used to determine how traffic is routed.
  • For all IPv4 traffic other than local (0.0.0.0/0), you can set the target as the internet gateway to access the internet. Subnets connected to a routing table with an internet gateway are considered public subnets.
DestinationTarget
10.0.0.0/16local
0.0.0.0/0Internet Gateway

Longest refix Match routing

Routing tables prioritize the most specific path, known as Longest Prefix Match. If there are overlapping or matching paths in the routing table, additional rules apply.
Here’s an example explaining Longest Prefix Match. In this routing table, there are two paths:

  • The first path is an IPv4 route pointing to internet traffic (0.0.0.0/0), and this points to the internet gateway.
  • The second path is an IPv4 route pointing to Transit Gateway (172.30.0.0/16), which handles traffic directed to tgw-11223344556677889. All traffic from subnets within the 172.30.0.0/16 IP range will use the Transit Gateway connection as it’s a more specific route than the internet gateway. Additionally, any traffic destined within the VPC (10.0.0.0/16) will be routed internally using the local route. Other traffic from subnets will use the internet gateway.
VPC route table example
PriorityDestinationTarget
110.0.0.0/16local
2172.30.0.0/16Transit Gateway
30.0.0.0/0Internet Gateway

Routing Scenarios

Below are examples of routing for the VPC's internet gateway, NAT instance, and Transit Gateway.

Routing via Internet Gateway

To make a subnet a public subnet, you can add an internet gateway to the routing table. First, you need to create and connect an internet gateway to the VPC, then add a route for IPv4 traffic with a destination of 0.0.0.0/0 and set the target to the internet gateway.

DestinationTarget
0.0.0.0/0Internet Gateway

Routing via NAT Instance

To connect instances in a private subnet to the internet, you can start a NAT instance. Then, add a route in the private subnet's routing table directing IPv4 internet traffic (0.0.0.0/0) to the NAT instance. For detailed instructions, refer to Appendix: Using NAT Instance.

DestinationTarget
0.0.0.0/0NAT Instance

Routing to Transit Gateway

When connecting a Transit Gateway to a VPC, you need to add routes in the VPC's routing table for traffic that should go through the Transit Gateway. For example, let’s consider two VPCs:

  • VPC A has a CIDR block of 10.1.0.0/16 and is connected to Attachment-1.
  • VPC B has a CIDR block of 10.2.0.0/16 and is connected to Attachment-2.

To allow access to the Transit Gateway, VPC A's routing table must be configured as follows:

  1. The Transit Gateway's routing table should have the following settings for the VPC Attachment.

    DestinationTarget
    10.1.0.0/16local
    10.0.0.0/8Transit Gateway
  2. For details on Transit Gateway's routing table, refer to Transit Gateway Routing.

    DestinationTarget
    10.1.0.0/16Attachment-1
    10.0.0.0/8Attachment-2

Routing configuration and destination IP management

You can configure the destination IP address and the gateway (target type) through which traffic should pass. For routes with a local target type, the destination IP can only be set to the VPC CIDR block. For routes with an Internet Gateway target type, the destination IP can be set to any IP outside of the VPC CIDR block.

info

Routes with a local target type in the default routing table cannot be modified or deleted.

Available destination IP by target type
Target TypeTarget NameAvailable Destination IP
LocalLocalVPC CIDR Block
Internet GatewayIGW-uuidAny IP outside the VPC CIDR