Skip to content
  • There are no suggestions because the search field is empty.

Routing Table

The routing table is the key element that helps the router to make routing decisions by comparing the destination IP address of the packet with the entries in the routing table and selecting the best match. It maintains a list of known networks and the associated next-hop addresses or interfaces that should be used to forward packets to intended destinations. 

Routing tables are constantly updated by routing protocols (dynamic routing) or manually updated (static routing) by administrators to reflect changes in the network topology, such as link failures, new network connections, or changes in routing policies. Routers can forward packets more efficiently and reliably by maintaining an up-to-date routing table.

Showcase of the routing table and its function

Important: A routing table is not a database that stores everything the router will learn from different sources but rather a selection of only the best routes to each learned network regardless of the number of sources available.

Packets can only be forwarded to destination networks where the router has information in the routing table. When the destination IP address of the packet is unknown, the router discards that packet.

The only exception is when a default route exists in the routing table, which is used to route packets to networks for which no specific match is found in the routing table. So, instead of dropping these packets, the default route allows the router to forward them to a pre-defined gateway or next-hop address.

Each entry in the routing table contains information about the learned network, the corresponding exit interface, and the next-hop IP address by which the destination network can be reached. Based on how the router learns about the networks or their purpose, the routing table may contain four different types of entries:

  • Directly connected networks
  • Static routes
  • Dynamic routes
  • Default route

Routing table sample

From the figure above, you will notice that the routing table may contain many entries, where some are directly connected networks, while others learned either statically (manually configured) or learned through routing protocols such as OSPF, RIP, and EIGRP. 

Directly Connected Networks

All directly connected networks are part of the routing table. After enabling an interface and assigning an IP address to it, the network is automatically added to the routing table. The network is also removed from the routing table if an interface goes down.

An active and properly configured interface creates two entries in the routing table. As you can see in the image below, each entry contains information, namely, a route source code, a destination network, and an outgoing or exit interface.

Directly connected network and IP address sample routing table format

The route source code identifies how the route was learned. The “C” identifies a directly connected network, while “L” identifies the IP address assigned to the interface participating in that network.

The destination network for the “L” entry has a prefix length of /32, while the “C” entry has a prefix length corresponding to the network configured, in this case, /24. The exit interface is the one that is used for reaching the destination network. 

Static Routes

Static routes are entries in the routing table that appear after you manually create them. They can point to a specific network or function as a default route pointing to any network unknown to the router.

The image below shows how the routing information looks from R1’s perspective.

Sample static route topology with a default gateway

Several criteria define each static route in the routing table. As you can see in the image below, the “S” identifies the route to the destination network of 192.168.1.0/24 as static.

Sample static routing table entry

The default administrative distance of a static route is 1, and the metric is 0, which is not as important as in dynamic routing. At the end of the entry, there is information about the IP address of the next-hop router to which the packet is sent, in this case, 192.168.3.2.

Default Route

A default route is a type of static route, but instead of pointing to a specific network, it points to any network. It is also known as the gateway of last resort or simply a default gateway. Using a default route allows the router to communicate to any online network simply by forwarding all packets to the internet service provider. This way, R1 will provide internet access to internal devices, based on the image below.

Sample dynamic routing default gateway topology using an OSPF protocol and an Internet connection

As you will notice from the image below, the default route functions as an exit to the internet (the IP address of 203.0.113.1 in the ISP). Like any standard static route, it is identified with “S,” and the additional asterisk identifies the route as the default. The destination network for the default route is always 0.0.0.0/0, meaning pointing to anywhere.  

Sample default gateway routing table entry

Dynamic Routes

Dynamic routes are entries in the routing table that the router learns from other routers by exchanging routing updates with them using dynamic routing protocols such as RIP, EIGRP, OSPF, IS-IS, and BGP. 

Now, R2 and R3 can exchange routing information through the OSPF protocol instead of using static routes (see the image below).

Sample dynamic routing topology using an OSPF protocol

As you can see from the image below, the code in front of the destination network identifies the routing protocol through which the route was learned, where “O” means OSPF.

Sample OSPF routing table entry

The rest of the criteria is the same as with the static routes, with the difference that now the metric is extremely important for the path selection process, and the administrative distance is 110. Additionally, there is information about the time that elapsed since the network was learned and the exit interface.