Routing and Switching form the foundation of computer networks and the Internet in general. A network engineer must know routing principles like the back of his/her hand!!
The core functionality of Layer 3 in the OSI model (Network Layer) is to forward (route) packets received on an interface of a routing device to the best destination.
It is the router’s job to select the best path that will deliver a packet to its destination as quickly and efficiently as possible. This path selection process depends on the destination IP address of the packet received and the knowledge that the Router has about reaching that destination.
Routing and Routing Tables
The “knowledge” that a Router has about the way to reach destination networks is stored in the “Routing Table” of the device.
This Routing Table contains all known destination networks, how they were learned and how to reach them (outgoing Interface).
The entire process of building this Routing Table relies on the information from neighboring routers (dynamic routes) or from statically configured entries by the network administrator (static routes).
This means when a network topology is created, there has to be some kind of configuration for the devices on that network to communicate with each other. The two major options are dynamic routing and static routing – these are basically how routers learn about routes to destination networks.
When dynamic routing is used, a routing protocol has to be configured on the Layer3 devices on the network, in order for them to share routing information.
Some popular routing protocols supported by Cisco routers include Routing Information Protocol (RIP), Open Shortest Path First Protocol (OSPF), Interior Gateway Routing Protocol (IGRP) and Extended Interior Gateway Routing Protocol (EIGRP), among others.
When you opt for the implementation of dynamic routing, note that all routers on the network must be configured with one or more dynamic routing protocols.
If multiple routing protocols are used, then you have to implement what is known as “route redistribution”, which allows multiple routing protocols to work together and share routing information.
Although dynamic routing has the advantage of automatically updating the routing table, it has a disadvantage of overusing router resources due to its nature of sending periodic updates. When dynamic routing is used, routing information is automatically learned and added to the routing table.
Static routing deals with the manual configuration of routes by the administrator. This means routing information is manually inserted into the routing table.
This information includes things such as destination IP addresses, administrative distance or cost of getting to the destination network, and gateway IP to reach the destination network.
The “show ip route” command explained
Once a routing table is created i.e. there is convergence in the network, a logical topology is created from the physical network topology.
At this stage, routers on the network will have all the necessary information to forward packets they receive to the right destination.
As a network administrator, it is important that you know how to verify this information. It is crucial that you know how to check the routing table to see if you have all the routes needed for complete network communication to take place.
The “show ip route” command is one of the most important commands related to routing on Cisco IOS devices.
It gives you detailed information about the networks that are known to the router, either directly connected to the router, statically configured using static routing or automatically added to the routing table using dynamic routing protocols.
Let us take a look at the output from a show ip route command to understand how it works using the topology depicted below.
The command was executed on router R2 shown in the figure below.
R2#show ip route
C – connected, S – static, I – IGRP, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2, E – EGP
i – IS-IS, L1 – IS-IS level-1, L2 – IS-IS level-2, ia – IS-IS inter area
* – candidate default, U – per-user static route, o – ODR P – periodic downloaded static route Gateway of last resort is not set.
C 192.168.1.0/24 is directly connected, Serial0/0/0
C 192.168.2.0/24 is directly connected, Serial0/1/0
R 192.168.3.0/24 [120/1] via 192.168.1.1, 00:00:18, Serial0/0/0
R 192.168.4.0/24 [120/2] via 192.168.1.1, 00:00:18, Serial0/0/0
The C in the routing table output means that the networks listed are “directly connected”. These represent the networks of the IP addresses configured on the physical (or virtual) interfaces of the device.
The R in the routing table shows destination networks learned via RIP dynamic routing protocol. If we were running OSPF, the entry would show O instead of R.
So, Router R2 is learning about the other networks via RIP routing protocol, which is depicted as R in the codes as we’ve said above.
For example, network 192.168.3.0/24 has been learned via 192.168.1.1 and can be reached via Serial0/0/0. This route has been added to the routing table by RIP.
As mentioned earlier, the routing table contains ALL the information about routes that are known to the router.
Other “Show IP Route” command options
show ip route [ip address] : shows only information about the specified IP address.
show ip route [ospf, rip, eigrp, etc] : shows only routing information learned from the specified routing protocol (e.g show ip route ospf).
show ip route static : displays information about statically configured routes.
show ip route connected : displays information about directly connected networks.
show ip route summary : shows summary information about ALL IP routes in the routing table.
- Cisco Show Interface Command on Routers and Switches Explained
- Configuring GRE Tunnel Through a Cisco ASA Firewall
- The Protocol of the Internet – eBGP and iBGP Tutorial and Configuration
- How to Configure Static Routing on Cisco IOS Routers (Examples)
- Redistribution Between Cisco EIGRP into OSPF and Vice Versa (Example)