The Need For Routing Protocols
Routers within a network use routing protocols to talk with one another so that updates and changes to the network can be adapted to dynamically without any major involvement from the network administrator. A router in a network has a routing table so that it can keep track of where his fellow routers are. It is like his contact list or address book. If routing protocols didn’t exist we would have to configure static routes manually to each router in the network on every single router. This can be a lot of work if you have a lot of routers. If you only have static routes and one of your links goes down in the middle of your network there is no real way for the routers to update each other on the status of the broken link. YOU, the network administrator, will have to go into every single router on the network and remove the bad link and define an alternate route. Again, this can be a lot of work if you have a lot of routers in your network creating a lot of down time.
Using a routing protocol will solve this issue of having to do all this manual work every time there is a change in your network. In the rest of this article we are going to focus on RIPv1 and its predicesor RIPv2, but there are several other routing protocols that we will learn about later for the ICND2 Exam and the CCNA Exam. RIP is a great tool to learn about routing protocols because it is simple to understand and easy to configure. Other routing protocols like EIGRP, OSPF and IS-IS are more advanced than RIP, but build upon RIP’s core functionality. We focus on learning RIP first because it builds a solid foundation of Routing Protocol knowledge that will make learning more advanced routing protocols much easier. For the ICND1 Exam you will need to know everything about RIPv2 (and RIPv1), and have only basic understanding for EIGRP, OSPF, and IS-IS.
So, what is a routing protocol? Basically it is a language or format that routers use to communicate with each other, so that they can automatically learn about new routes and make new routing dicisions incase a link goes down somewhere in the network. Having this ability to automatically make decisions can help keep your network running smoothly even when problems arise (Smoothly will depend largely on if you have redundant links in your network or not).
Distance Vector
RIP is a distance vector routing protocol. Other types of routing protocols exist like link-state or the combination of link-state and distance vector, but we will have to save those for another post. First let’s stick to the basics and learn about why RIP is considered a distance vector routing protocol.
Hop Count
Routing protocols use metrics to determine the quality of a route between two routers. Some routing protocols use more than one metric, but RIP only uses one metric which is known as hop count. Hop count can be defined as the number of routers a packet has to go through in order to reach its destination. If there are 2 routers, R1 and R2, that are directly connected to each other than the hop count to get from R1 to R2 will be 0.
Now, if there are 3 routers: R1, R2, and R3, that are connected in series in a straight line, and R1 wants to send something to R3 it will first have to go through R2. So, the hop count for the route from R1 to R2 is 1. Another way to look at this is to that the hop count from R1 to R2 is 0 so once the packet gets pasts R2 it will increment the hop count by 1. 0 + 1 = 1. Therefore the hop count from R1 to R3 is 1.

Now if there were 4 routers, R1, R2, R3, and R4 all connected to each other in a straight line then the hop count from R1 to R4 wil be 2 because the information coming from R1 will have to go through two routers, R2 and R3, before it can get to R4.

One of the reasons why routers use metrics is to determine the best path between 2 routes. Lets say we have a pentagon shaped network consisting of 5 routers, R1 through R5.

R1 wants to determine the best route to get to R4. It has two paths to choose from.
Path 1: R1 –> R5 –> R4 Which has a hop count of 1.
Path 2: R1–> R2 –> R3 –> R4 Which has a hop count of 2.
Both paths will get you to R4 but RIP, because it relies soley on hop count will choose Path1 because it has a lesser hop count. This is actually considered a limiation of RIP because even though Path 1 is the shortest it might not be the fastest route. Huh? Let me explain… Lets say that the path from R1–>R5 is using a 56kbps dial up connection and the path from R5–>R4 is also using a 56kbps dial up connection. However every link in the path from R1–>R2–>R3–>R4 is using a 1.44Mbps T1 connection. Even though the Path2 requires more hops, it is actually faster. However RIP doesn’t know how to keep track of link speeds or the quality of the paths so it will always default to the shortest route, in this case, path1. Other routing protocols, like EIGRP and OSPF are smart enough to choose Path2, but we will save those details for a later post. For now, simply remember that RIP chooses the path with the fewest number of hops.
RIP has a maximum hop count of 15. Which means that anything greater than 15 hops away is considered unreachable and will not be included in the routing table. RIP also uses the hop count of 16 to mark a route that needs to be removed.
Updates
Let’s take a look at how RIP keeps track of other routers in the network. Let’s say that we 3 routers connected in series and we also just finished setting up RIP on each router (I’ll show you how to do this later) and all the routers are just beginning to talk to each other.

R1 will already have a routing table entry for R2 with a hop count of 0. R2 will have two routing table entries. One going to R1 and the other to R3 each with a hop count of 0. R3 will have a routing table entry for R2 with a hop count of 0. These routes are automatically placed in the routing table because the links are directly connected. See image below:

Now we are going to learn about how R1 will learn about R3. RIP only sends updates to its neighbor, but when it sends an update to its neighbor it sends its entire routing table. Let’s start with R1. It currently has a routing table entry for R2 and its loopback interface. It will send an update to R2 letting it know that it has a path to the 192.168.3.0 network with a hop count of 0.R2 receives this update and since R1 can get to the 192.168.3.0 network with 0 hops, R2 adds 1 to the hop count and makes an entry for the 192.168.3.0 network with a hop count of 1.

Now R2 is going to send its entire routing table to R3. R3 already has an entry for R2 & its loopback interface, but learns about R1 and stores it in its routing table with a hop count of 1. It also leans about the 192.168.3.0 network and stores it in its routing table with a hop count of 2.

R3 will then send its routing table to R2 and the R2 will send its routing table to R1.
Now this isn’t the exact path that the routers will go about talking to each other, but now you at least get the idea of how it works. Once all the routers learn about each other they are considered converged.
RIP uses several different timers to keep the network in this converged state. The first timer is the Update Timer which is 30 seconds. This means that every 30 seconds RIP is going to send its routing table to its neighbor. There are 4 main timers for RIP:
- Update Timer: 30 seconds
- Invalid timer: 180 seconds
- Holddown timer: 180 seconds
- Flush timer: 240 seconds
Diffirences between RIPv1 and RIPv2
RIPv2 improves upon several key features that makes it better to use in modern networks.
- RIPv2 is a classless routing protocol instead of classful
- RIPv2 supports variable length subnet masks
- RIPv2 supports Classless Inter-domain Routing
- RIPv2 supports Authentication
- RIPv2 sends updates via multicast instead of broadcast
- RIPv2 includes the next hop address in its update
Configuring RIPv2

First lets log into R1 and configure it:
[pre]
r1>
r1>enable
r1#config t
Enter configuration commands, one per line. End with CNTL/Z.
r1(config)#interface loopback 0
r1(config-if)#ip address 192.168.3.1 255.255.255.0
r1(config-if)#no shutdown
r1(config-if)#exit
r1(config)#
r1(config)#interface fastEthernet 0/0
r1(config-if)#ip address 192.168.1.2 255.255.255.0
r1(config-if)#no shutdown
r1(config-if)#exit
r1(config)#router rip
r1(config-router)#version 2
r1(config-router)#network 192.168.3.0
r1(config-router)#network 192.168.1.0
r1(config-router)#
r1(config-router)#exit
r1(config)#exit
r1#
[/pre]
Looking at the above commands for R1 you see that we first configured the IP address for the ‘loopback 0′ interface and turned it on. Then we configured the ip address for ‘fastEthernet 0/0′ and turned the interface on with the ‘no shutdown’ command. Once we had the interfaces configured we set up rip on the router with the ‘router rip’ command. We then used the ‘version 2′ command to specify that we are using RIPv2 because by default Cisco routers use RIPv1. Still under the rip router configuration we specified the networks that RIP is going to advertise.
Now log into R2 and configure it:
[pre]
r2>enable
r2#config t
Enter configuration commands, one per line. End with CNTL/Z.
r2(config)#interface ethernet 0/0
r2(config-if)#ip address 192.168.1.1 255.255.255.0
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#interface ethernet 0/1
r2(config-if)#ip address 192.168.2.1 255.255.255.0
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#router rip
r2(config-router)#version 2
r2(config-router)#network 192.168.1.0
r2(config-router)#network 192.168.2.0
r2(config-router)#exit
r2(config)#exit
r2#
[/pre]
Now log into R3 and configure it:
[pre]
r3>
r3>enable
r3#config t
Enter configuration commands, one per line. End with CNTL/Z.
r3(config)#interface ethernet 0/0
r3(config-if)#ip address 192.168.2.2 255.255.255.0
r3(config-if)#no shutdown
r3(config-if)#exit
r3(config)#interface loopback 0
r3(config-if)#ip address 192.168.4.1 255.255.255.0
r3(config-if)#no shutdown
r3(config-if)#exit
r3(config)#router rip
r3(config-router)#version 2
r3(config-router)#network 192.168.2.0
r3(config-router)#network 192.168.4.0
r3(config-router)#exit
r3(config)#exit
r3#
r3#
[/pre]
Verifying Your RIPv2 Configuration
Now that we have RIP configured on all 3 routers let’s verify that it is working correctly. Start by logging into R1 and issuing the ‘show ip protocols’ command:
[pre]
r1#sh ip protocols
Routing Protocol is “rip”
Sending updates every 30 seconds, next due in 9 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 2, receive version 2
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 2 2
Loopback0 2 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
192.168.1.0
192.168.3.0
Routing Information Sources:
Gateway Distance Last Update
192.168.1.1 120 00:00:14
Distance: (default is 120)
r1#
[/pre]
From the the ‘show ip protocols’ command we can find out a lot of things about RIP and other protocols that are running on our router. Since we are only using 1 routing protocol, RIP is the only one that shows up.
The first thing that we see from this command is that we are in fact using “rip”, but how can we tell we tell if we are using RIPv1 or RIPv2? For this you will have to look down about 6 lines and look for the line: [pre]Default version control: send version 2, receive version 2[/pre] If you were using RIPv1 this line would say: [pre]Default version control: send version1, receive version 1[/pre]
Also from the ‘show ip protocols’ command we can verify all of the timers that RIP is using. We see that updates are being sent every 30 seconds and also the remaining time until the next schedules update. We also see that the Invalid timer and the hold down timer are both set for 180 seconds. The flush timer is set to 240 seconds.
From this command you can also verify the Administrative Distance which is 120 and the Gateway that is being used.
Another important command to verify your RIPv2 configuration is ‘show ip route’:
[pre]
r1#sh ip route
Codes: 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
R 192.168.4.0/24 [120/2] via 192.168.1.1, 00:00:28, FastEthernet0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
R 192.168.2.0/24 [120/1] via 192.168.1.1, 00:00:28, FastEthernet0/0
C 192.168.3.0/24 is directly connected, Loopback0
r1#
[/pre]
From the ‘show ip route’ command can see our routing table for ‘r1′. The ‘R’ represents routes that were learned via RIP and the ‘C’ represents routes that are directly connected. Let’s look at the first route more closely:
[pre]
R 192.168.4.0/24 [120/2] via 192.168.1.1, 00:00:28, FastEthernet0/0
[/pre]
First we see the ‘R’ which just means we are using RIP. Second we see the network and subnet mask for this route. Third we see the administrative distance of ’120′ followed by the hop count of ’2′. Fourth we see the next hop ip address. Fifth we see when this route was last updated. Sixth we see which interface this route should be sent out.
Troubleshooting Our RIP Configuration
Two commands that are useful when troubleshooting RIP are:
- debug ip protocols
- debug ip rip
With these debug commands you can actually see when the rip updates get sent every 30 seconds and see the process RIP takes when it converges.
