Skip to main content

Routing Table

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

By creating a route 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 route table created by default, referred to as the default route table. The default route table is marked as Yes in the KakaoCloud console > VPC > Routing Table menu.

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

info

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

Rules and considerations of route tables

When adding routes to a route table, you must follow certain rules and considerations. Please review the following before adding a new route:

  • If the type is set to Instance, you can add a route that matches the subnet CIDR of the corresponding VPC.
  • You cannot add the link-local address range 169.254.0.0/16 or any destination CIDRs within it, as they are reserved for KakaoCloud services.
  • Instances with two or more network interfaces cannot be designated as targets in the route table. This feature will be supported in the future.

Types of route tables

Main route table

When you create a VPC, a Default route table is automatically created. If you do not explicitly set a route table when creating a new subnet, all subnets will be associated with the default route table. In the VPC service menu of the KakaoCloud console, the item where the Default column on the Routing Table page is marked as Yes is the default route table. The following rules apply to the default route table:

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

Custom route table

Users can freely create route tables and add routes as needed. After creating a new subnet and a new route 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 route table, and users can adjust the flow of traffic and choose the optimal path based on the destination. However, when deleting a route table, it's important to note that since the route table is closely related to the associated subnets, you must first disassociate all subnets connected to the route table before deleting it.

Configuration of route table

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

  • You can add more specific routes to the route 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 route 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 route 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

Route tables prioritize the most specific path, known as Longest Prefix Match. If there are overlapping or matching paths in the route table, additional rules apply.
Here’s an example explaining Longest Prefix Match. In this route 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 route 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 route 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 route 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 route table must be configured as follows:

  1. The Transit Gateway's route 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 route 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 route 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