What is a Routing Table? How It Works Explained with Configuration Guide

What is a Routing Table

Routing is the process of determining the path for data packets to travel from a source network to a destination network. It involves the transfer of packets based on the destination network address, rather than the destination host address. Routing is performed by network devices known as routers, which use routing tables and protocols to decide the most efficient path for forwarding the packets to their final destination. The routing table maintain the best route of the network

The routing table contains the following elements:

  • Destination Network and Subnet Mask
  • Next hop of the destination router
  • Routing metrics and the Administrative Distance

Routing is based on two types of protocols:

  1. Routed Protocol: IP addresses are assigned to devices, and data is routed between them. Examples include IP and IPX.
  2. Routing Protocol: Packets are transferred from source to destination based on the best path. Many protocols, such as RIP, OSPF, and EIGRP, help find the best path.

To find the best path, a router considers the following elements:

  • Prefix Length
  • Metric
  • Administrative Distance

The prefix length describes the number of bits used to identify the network. A longer prefix length indicates a more specific network.

Let’s understand with a simple example. We have two network addresses:

  • 10.1.5.0/24
  • 10.0.0.0/8

The router will perform a bit-by-bit comparison in this scenario to determine the specific network. The 10.1.5.0 network is more specific than the 10.0.0.0 network. Therefore, the router will use the 10.1.5.0 network regardless of metric or administrative distance.

Difference between Administrative Distance and Metric

The metric is used to allow the router to choose the best path within a routing protocol. Distance vector protocols use distance (hop count) for determining their best path, while link-state protocols use cost as their metric for the best path to the network.

The routing table only includes the best path in its database. If a routing protocol (RIP) has four routes to forward, it decides based on the distance (hop count) for the best path. Further, If the routes have the same distance, it will load balance the traffic.

If your router runs multiple routing protocols, such as RIP and OSPF, the selection of the route is based on the best administrative distance. In this case, the administrative distance of OSPF is less than that of RIP, so the OSPF route will be preferred.

The Administrative Distance of all protocols are already defined, here is the table    

Connected0
Static1
EIGRP Summary5
External BGP20
Internal EIGRP90
IGRP100
OSPF110
IS-IS115
RIP120
External EIGRP170
Internal BGP200
Unknown255

Difference Between TCP and UDP Protocols | Brief with Real-Time Examples

A Route with an unknown administrative distance will never be part of the Routing table.

To View the Routing table in the Router command

Router# Show ip route

The routing table will show as follows

C           192.180.1.0/24 directly connected eth 0

C           150.50.100.0 directly connected Lo 1

C           192.168.122.0 directly connected Se0

C           192.168.111.0 directly connected S1

R           10.0.0.0 [120/1] via 192.168.122.1, 00:00:00:00, Se0

                          [120/1] via 192.168.111.2, 00:00:00:00, Se1

S*         0.0.0.0/ 0 [1/0] via 192.168.1.1

In the routing table, the label of each route is named as follows

C Directly Connected Route

S Static

S* Default Route

D EIGRP

R RIP

I IGRP

I IS-IS

O OSPF

In this table RIP contains the route [120/1], 120 is the administrative distance and 1 is the hop count to reach the network.

To clear all the routes and then repopulate the command

Route # clear ip route

Example for Choosing the Best Route

Assuming the following routes exist in the routing table

O       192.168.111.0/24 [110/58] via 192.168.131.1, 00:00:00:00, Se3

R       192.168.111.0/24 [120/1]   via 192.168.123.1, 00:00:00:00, Se0

R       192.168.111.0/24 [120/5] via 192.168.5.2, 00:00:00:00, Se1

S        192.168.0.0/16 [1/0] via 10.1.1.1

In this example, there are two RIP routes and the one is the OSPF route. S means single static route.

So, choose the best route in this scenario, the second RIP route will not inserted because the administrative distance 5 is greater than 1. A static route will be added in the routing table because the administrative distance is less but it’s not suitable based on the Prefix length

O       192.168.111.0/24 [110/58] via 192.168.131.1, 00:00:00:00, Se3

R       192.168.111.0/24 [120/1]   via 192.168.123.1, 00:00:00:00, Se0

S        192.168.0.0/16 [1/0] via 10.1.1.1

Metrics always calculate first but are not preferred over administrative distance.

This Post Has One Comment

Leave a Reply