What is a Routing Table -Explained

A routing table has information usually viewed in table format to decide where to send data packets. All IP-enabled devices, including routers, direct a packet to the destination using routing tables.

The router gets route information from the routing table and selects the best path for the destination. Each packet has information about its source and destination. The router examines the packet and matches it to the routing table entry, providing the best match for its destination. Then, the router sends the packet to the next hop on its route across the network.

We can configure routes manually or dynamically. The static routes do not change unless a network administrator manually changes them, but the dynamic routes automatically update and change according to routing protocols. The routing protocols exchange information about the network topology and network changes and update the routing table.

Dynamic routing protocols also allow devices to listen to the network and react to occurrences like device failures and network congestion. The routing table is a data file storing route information about directly connected and remote networks.

  • Directly connected routes—When configuring and activating the interface, the router adds a directly connected route against the interface.
  • Remote routes—These are the routes from remote networks to other routers. We can configure these routes statically or dynamically.

Routing Table Sources

We can check the routing information on a Cisco router using the show ip route command. The router also provides additional route information, including the source of the route, with this command. The following are the different sources of the routing entries.

  • Local Route interfaces—The router adds the route when we configure and activate the router interface. This entry is available in all IOS for IPv6, but for IPv4, the option is available only in IOS 15 or newer versions.
  • Directly connected interfaces—The routes that were directly connected were added to the routing table when we activated and configured the interface.
  • Static routes– The static route is added to the routing table when a route is manually configured, and the exit interface is active.
  • Dynamic routing protocol—The routing protocols that dynamically learn the network’s information and add the information to the routing table, such as RIP, EIGRP, and OSPF.

We can find the routing entry sources with a code. The code tells us the source of the route information. The figure below illustrates the codes of the route sources, including the entries in a single route:

Routing Table

Some common codes are:

  • C–This code is for the directly connected network.
  • L– This code is for the Local Router/Switch Interface route.
  • S– We can find a static route with this code.
  • D– This is the identification code for a dynamically learned network from another EIGRP router.
  • O– This code Identifies a dynamically learned network from another router using the OSPF.
  • R– This code Identifies a dynamically learned network from another router using the RIP.
  • S*– This is the default route.

Remote Network Routing Entries

Understanding the content of an IPv4 and IPv6 routing table is most important. We have marked the route to destination network 172.16.17.0 in the above figure. The marked entry for 172.16.17.0 identifies the following information:

  • Route source—This entry identifies how the router adds this route. In this example, the entry is “D”, meaning the router learns this route from the dynamic routing protocol EIGRP.
  • Destination network– This is the entry for remote network Identification. In this example, the remote network is 172.16.17.0.
  • Administrative distance—This is the trustworthiness of the route source. Lower values indicate a more trustworthy route to the destination network.
  • Metric—The metric is the cost of each available route, so the router selects the most cost-effective path. The Lower values indicate preferred routes to the destination.
  • Next-hop– This is the IPv4 address of the next connected router to send the packet.
  • Route timestamp– This entry shows the timing since the route was added.
  • Outgoing interface–This entry identifies the exit interface of the router that sends a packet toward the destination.

Directly Connected Interfaces

A newly Installed router, without any configured and active interface, has an empty routing table, as shown in the figure below.

Before the interface state is up/up and added to the routing table, the interface must be assigned a valid IPv4 or IPv6 address and must not be shut down. It should also be able to receive the carrier signals from another device, e.g., router, switch, host, etc.

When the interface is up, the network of that interface is added automatically to the routing table as a directly connected network. For example, when we configure the interfaces of Router5 with IPv4 addresses and issue the no shutdown command, it receives the carrier signals from the router and hosts. It updates the routing table from an empty routing table, as shown in the figure below.

Directly Connected Routes (C) and Local Routes (L) Entries

The properly configured connected interface creates two routing table entries. The figure below displays the IPv4 routing table entries on Router5 for the directly connected network 172.16.19.0. The directly connected router interfaces’ routing entries contain the following information:

  • Route source– This entry identifies the route source. Directly connected interfaces have two route source codes. “C” and “L”. The “C” is for the directly connected network, and the “L” is for the IPv4 address assigned to the router interface.
  • Destination network– The address of the remote network.
  • Outgoing interface–This is the router’s outgoing interface for the destination network.

Another route it is showing is the Local (L) route. The difference between Local and Directly connected routes is that a directly connected route is a route to a network that is directly attached to the interface and Local is the route that belongs to the router/switch itself in the above example you can see that in the directly connected route the destination is 172.16.19.0/24 address but the destination in Local route is 172.16.19.1 which is configured on the same Router (Router5)