The concept of routing is one of the basic concepts in networking. It is the process through which packets are forwarded from a source to destination across different networks (or subnets).
A router is the device that performs routing. It receives packets, and reads the packet header to determine the source address, destination address, protocol, time-to-live, QoS and other information. Then, it checks its routing table and uses this information to decide where it would forward the packet.
Route table
Route tables are the records the router uses to map out all the networks it is connected to, and which of its interface it needs to send a packet to in order to reach the network.
This is what a route table looks like...
It contains information about routes such as the destination network, next hop, the preference value of such route, how it was learnt, and from which physical interface the router can access such a route.
Types of routes
There are three types of routes that a router can populate its route tables with:
Direct routes
Static routes
Dynamic routes
Direct routes are routes to networks the router is directly connected to. A router has a Network Interface Card for each of its interfaces, so all interfaces can be assigned their own IP addresses. This is the first and simplest way of letting a router know which subnets it is connected to. When you assign an interface an address in a particular subnet, the router takes it that that interface is connected to that subnet and populates its route table with a direct route.
Static route. These are routes added manually by the network administrator. In the case that a router is not directly connected to a network and you want it to reach that network, you can configure a static route such that the router knows where to send the packet if it is addressed to that network.
The static route here on router R1 is the route to PC 5's network.
Dynamic routes. These are not much different from the static routes. They are also routes to distant and remotely located networks, but these are rather added by routing protocols than by a human being. When a routing protocol is configured on a router, the routers talk to each other and share their direct routes with each other thereby enabling them to populate their route tables and provide reachability to networks they are not directly connected to. These routing protocols include OSPF, EIGRP, IS-IS, RIP, and BGP.
What if there are more than one route?
When there is more than one route to a destination in a route table, how does the router choose the optimal route?
The router uses many different methods like preference values and cost metrics.
Route metrics are used by routing protocols to calculate the best path to a destination.
Route preference or administrative distance is a number used to establish a hierarchy of preferences for routes. By default, the values are assigned based on how the route was learnt. For example, Cisco routers assign the values 0 to directly connected routes, 1 to static routes, and 110 to OSPF routes. The lesser the number, the higher the priority. In Huawei routers, by default direct routes have a preference of 0, static routes have a preference of 60, and OSPF routes have a preference of 10. This means that by default, Huawei prefers OSPF routes to static routes and Cisco prefers static routes to OSPF routes.
Routing in the cloud
In cloud networking, the concept of routing was still carried on but with a lower resolution. There are no direct routes or dynamic routes, just static routes in route tables. Also, cloud service providers allow you to use service or resource names as the next hops (also known as targets).
In cloud networking, we generally have two types of routes:
Local routes
Public routes
Local routes are the routes that enable the resources in a virtual network (VPC, VNet, or VCN) to communicate with each other. These routes are implicit, and generally do not appear in the route table. The public routes enable resources in the virtual networks to communicate with resources outside the virtual networks or to redirect the way the subnets within a virtual network are linked together. These are the ones you see and add to the route tables.
After creating a route table, you need to associate it with the respective subnets for it to control the routing of traffic to and from that subnet. This is the cloud equivalent of connecting a real router to a switch.
The cloud routers are in some way simplistic in the sense that the user's experience of the router is just the route table, but in a real router, you have access to more than just the route table.
Routing through route tables is useful in cases where the administrator wants to route traffic through a network virtual appliance or load balancer, or through another cloud network or subnet for whatever reason. Like in traditional networking, routing here is to tell a resource how to reach another resource in a network or across networks; but it's not as detailed and fine-grained.
Conclusion
In this article, I talked about what routing is, what a route table is, and how route tables apply in both traditional networking and cloud networking. I hope you learnt something from it.
Do not forget to subscribe to the newsletter and share the article if you enjoyed it. You can also follow The Network Bits on X or connect with me on LinkedIn.