A routing table has information usually viewed in table format, decide where to send data packets. All IP-enabled devices including routers use routing tables to direct a packet to the destination.
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 and 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 by 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 data file store route information about directly connected and remote networks.
- Directly connected routes– When we configure and activate the interface, the router adds directly connected route against the interface.
- Remote routes– This is the route to 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. Following are the different sources of the routing entries.
- Local Route interfaces– The router adds the route when we configure and activate router interface. This entry is available in all IOS for IPv6 and for IPv4 the option is available only in IOS 15 or newer versions.
- Directly connected interfaces– The directly connected routes added to the routing table when we activate 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 networks 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:
Some common codes are:
- C–This code for is for the directly connected network.
- S– We can find a static route with this code.
- D– This is the identification code for dynamically learned network from another router using EIGRP.
- O– This code Identify a dynamically learned network from another router using the OSPF.
- R– This code Identify a dynamically learned network from another router using the RIP.
Remote Network Routing Entries
To understand the content of an IPv4 and IPv6 routing table is most important. We have marked the route to destination network 172.16.200.0 in the above figure. The marked entry for 172.16.200.0 identifies the following information:
- Route source– This entry identifies how the router adds this route. In this example, the entry is “D” which means that the router learns this route from dynamic routing protocol RIP.
- Destination network– This is the entry for remote network Identification. In this example, the remote network is 172.16.200.0.
- Administrative distance– This is the trustworthiness of the route source. Lower values indicate more trustworthiness route to the destination network.
- Metric– The metric the cost to each available route so that the router select 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 added.
- Outgoing interface–This entry Identifies the exit interface of the router to send 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 adds it to the routing table, the interface must be assigned a valid IPv4 or IPv6 address. The interface must be in no shutdown state. It should also be in a position 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 directly connected network. For example, when we configured the interfaces of the Router5 with IPv4 addresses and issue the no shutdown command and 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 Routing Table Entries
The properly configured connected interface actually creates two routing table entries. The figure below displays the IPv4 routing table entries on Router5 for the directly connected network 192.168.11.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 directly connected network and “L” is for IPv4 address assigned to the router interface.
- Destination network– The address of the remote network.
- Outgoing interface–This is the router outgoing interface for the destination network.