Route tables
In this article:
Route tables#
General information#
Route tables contain a set of rules (routes), which are used to direct network traffic.
Each subnet in a VPC is associated with a route table. If necessary, you can associate a subnet with an arbitrary route table; subnets without an explicit association will be automatically associated with the main route table.
Glossary#
Route table – a route table you create for your VPC.
Main route table – a route table that is automatically added when you create a VPC. It controls the routing for all VPC subnets, which are not explicitly associated with a route table.
Route propagation – the propagation of learned routes. If this feature is enabled, your VPN connection routes will be dynamically included in the specified routing table.
Route – a route table entry containing information about where to direct traffic for IP addresses from the specified network.
Network – a range of IP addresses in CIDR notation for which you want to add a routing rule.
Gateway – a standard Internet gateway, VPN connection, instance or network interface where traffic should be sent according to the current rule.
Route selection algorithm#
The cloud uses the most accurate (priority) route for the network traffic, in accordance with the generally accepted rules for choosing the best route:
static routes have higher priority than dynamic ones;
the route with the longest subnet prefix will get higher priority if several routes are suitable for the packet;
if a suitable route for the packet is not found in the route table associated with the subnet, then the route lookup is now stopped and the packet is discarded.
Operations with route tables#
Create a route table#
To create a new route table, go to Virtual machines Networking Route tables and click Create. In the window that opens, select the VPC in which you want to create the route table. You can also assign the Name tag and additional tags to the table. To complete the route table creation, click Create again.
Associate a route table with a subnet#
To associate a subnet with an arbitrary route table, go to Virtual machines Networking Route tables, select the table and click Associate with subnets. In the dialog window, select the subnets you want to associate it with and click Associate.
This operation can also be performed on the page of the selected route table. To do this, go to the Subnets tab and click Associate with subnets.
A subnet can only be associated with one route table at a time, but you can associate one route table with multiple subnets.
Important
This operation will change traffic routing in the selected subnets according to the specified or main route table rules.
Note
You can explicitly associate the main route table with a subnet, even if they are already implicitly associated.
Select a main route table#
K2 Cloud allows using multiple route tables, but you can specify only one main table. To set a selected route table as the main route table, go to Virtual machines Networking Route tables, select the table from the list or go to the route table page and click Set table as main.
This operation impacts routing rules of all subnets without explicit associations: all implicitly associated subnets will refer to the new main table, so additional confirmation is required to apply the changes. If you are sure that you need to change the main route table, in the dialog window, click again Set table as main.
Important
All implicitly associated subnets will use routing rules of the default table.
Disassociate a route table#
To disassociate a route table from a subnet, go to Virtual machines Networking Route tables, select the desired table and click Disassociate. In the dialog window, select the subnet you want to disassociate from. You can select multiple subnets at once. You can do the same in the Subnets tab on the route table page.
Important
This operation will change traffic routing in the selected subnets according to the specified or main route table rules.
Note
The main route table can only be disassociated from a subnet which it is explicitly associated with. If you cancel an explicit association of the main route table with a subnet, it will be implicitly associated with it.
Specify tags for a route table#
To add, modify or delete tags for a route table:
Go to the Network section Route tables.
In the resource table, select the route table for which tags should be edited and click on the table ID to go to its page.
Open the Tags tab.
To add a tag, click Add tag and specify the Key and Value fields.
To modify a tag, edit the required fields (Value and/or Key) of the respective tag.
To delete a tag, click the icon next to the tag you no longer need.
Note
If no tags have been set earlier, you can add the Name tag by clicking Add Name tag and specifying its value.
Note
You can also modify the Name tag in the Information tab by editing the corresponding field.
Click Apply to save the changes.
Delete a route table#
You can delete a route table if it is not the main one and is not associated with any subnet. To delete a route table, go to the respective section and select the desired table. Then click Delete and confirm the action. Besides, the route table can be deleted in the Information tab on its page.
Working with routing rules#
Go to the Routes tab on the route table page to get information about routing rules.
Each rule has a set of parameters:
Network – the range of IP addresses in CIDR notation where data is sent.
Gateway type – a standard Internet gateway, VPN connection, instance or network interface where traffic for the specified network should be sent.
Instance – ID of the instance this rule is related to.
State – information about the route state:
active – the route is active and used;
blackhole – a state in which traffic will be lost (for example, when a route goes through a VPN connection or instance’s network interface, which was deleted).
Add a route#
To add a routing rule, go to the page of the route table to which you want to add it and open the Routes tab. Click Add and set the required parameters.
Delete a route#
To delete a routing rule, go to the page of the route table from which you want to delete it and open the Routes tab. Select the route to be deleted and click Delete. You can delete several routes at once.
Route table information#
For general information about the available route tables, see the Route tables section. To view all route tables in the project, select All VPC in the VPC filter. To display route tables of a particular VPC, select the desired VPC in the filter.
To view detailed information about a particular route table, go to Virtual machines Networking Route tables and select the desired table from the list. To facilitate the route table search, select its relevant VPC in the VPC filter or use the search function.
Once you have selected the desired route table, click its ID. In addition to general information, the route table page contains data on the established routes and subnets which it is associated with.
The Information tab provides information about the VPC in which the route table is created, the number of associated subnets, whether the table is the main one, and whether BGP routes are installed in it, i.e. whether route propagation function is enabled. Here you can set a route table as main or delete it.
The Routes tab displays details of predefined routes. Here you can also add or delete a route.
The Subnets tab displays information about the subnets which the route table is associated with. Here you can also associate the table to other subnets and cancel the existing association.