Understanding Routing Tables: How They Enable Efficient Network Communication

Router:

A router is a networked device that forwards data packets between computer networks. The device is usually connected to two or more different networks. When a packet arrives at a router port, the router will read the address information from the packet to determine which port the packet will be sent to. For example, a router provides you with Internet access by connecting a LAN with the Internet.

When a packet arrives at the router, it checks the destination IP address of the received packet and makes a routing decision accordingly. The router uses the routing table to determine which interface to send packets to. The routing table lists all networks for known routes. Each router’s routing table is unique and stored in the device’s RAM.

Route Table:

A routing table is a set of rules, typically viewed in a tabular format, that determine where packets transmitting over an Internet Protocol (IP) network will be directed. All IP-enabled devices, including routers and switches, use routing tables. See the routing table below:

Destination      Subnet mask         Interface
 128.75.43.0      255.255.255.0       Eth0
 128.75.43.0      255.255.255.128     Eth1
 192.12.17.5      255.255.255.255     Eth3
 default                              Eth2

The entry corresponding to the default gateway configuration is the network destination of 0.0.0.0 with a netmask of 0.0.0.0. The subnet mask for the default route is always 255.255.255.255.

IP routing table entries:

The routing table contains the necessary information to forward the packet along the best path to its destination. Each packet contains information about its origin and destination. The routing table provides the device with instructions for sending the packet to the next hop of its route on the network.

Each entry in the routing table contains the following entries:

Network ID: The network ID or destination of the route.

Subnet Mask: A mask used to match the destination IP address to the network ID.

Next Hop: The IP address to which the packet is forwarded

Outgoing Interface: The outgoing interface of the packet should reach the destination network.

Metric: A common usage of this metric refers to the minimum number of hops (router crossover) to the network ID.

Route table entries can be used to store the following types of routes:

  • Directly attached network ID
  • Remote network ID
  • Host routes
  • Default route
  • destination

When the router receives a packet, it checks the destination IP address and looks at its routing table to find out which interface packet to send.

How is the routing table populated?

There are ways to maintain the routing table:

  • Networks that are directly connected are added automatically.
  • Use static routes.
  • Use dynamic routing.

These routing tables can be maintained manually or dynamically. In dynamic routing, the device automatically builds and maintains its routing table by exchanging information about the surrounding network topology using routing protocols. Dynamic routing tables allow devices to “listen” to the network and respond to events such as device failures and network congestion. The table of static network devices should not be changed unless manually changed by a network administrator.

Route determination process (use the routing table to find the subnet ID):

Consider that the network is divided into 4 subnets

As shown in the image above. The IP addresses of the 4 subnets are:

200.1.2.0 (Subnet a)
200.1.2.64 (Subnet b)
200.1.2.128 (Subnet c)
200.1.2.192 (Subnet d)

Then, the appearance of the routing table, which is maintained by the internal router, is as follows:

destinationSubnet maskinterface
200.1.2.0255.255.255.192a
200.1.2.64255.255.255.192b
200.1.2.128255.255.255.192c
200.1.2.192255.255.255.192d
default0.0.0.0e

Finding its right subnet (subnet ID), the router performs a bitwise “and” operation of the destination IP address mentioned on the packet, and all subnet masks correspond to one by one.

  • If there is only one match, the router will forward the packet on the corresponding interface.
  • If there are multiple matches, the router forwards the packet on the interface that corresponds to the longest subnet mask.
  • If there is no match, then the router forwards the packet on the interface corresponding to the default entry.

Example 1: Chapter 55 of GATE-CS-2004

EXAMPLE 2: CHAPTER 63 GATE IT 2006

Note that the routing table is not specific to Cisco devices. Even your Windows operating system has a route table that can be displayed using the route print command.