We are going to demonstrate the configuration of the RIP protocol, which belongs to the distance vector category. So let us analyze it according to our three criteria.
Distance Vector Routing Protocol
The first criteria is how routers discover each other and the answer to that lies in the fact that distance vector protocols will rely on neighbors to tell them the direction or vector toward destinations and how far away those destinations are, and so a routing protocol like RIP will advertise to its neighbors and obtain the information directly from its neighbors, those routers running the same protocol. In that sense, they rely on sort of a chain reaction.
In example, router would need to wait his neighbour routers to advertise to each other in chain. This makes them slower in understanding network changes and it also makes them rely on secondhand information, which also makes them inaccurate. They become even slower, when you see how they exchange information with their neighbors. They will periodically pass copies of the entire routing table. Some of them, like RIP version 1, will actually broadcast this information which is also a very inefficient method.
Source of Information and Discovering Routes
In terms of how distance vector protocols learn the information then, we were talking about periodic advertisements of the entire routing table coming from directly connected neighbors. Some of the information though is remote and so that is why they rely on secondhand information. The figure illustrates the chain reaction that would have to happen for A to learn about networks known to C. The exchange is periodic and it includes the complete routing table, so even if the topology does not change, routers keep telling each other about the same thing.
Other features of RIP result from our third criteria, how the protocols adjust to changes in the topology. The answer for a distance vector protocol like RIP is very slowly convergence timed or the amount of time it takes for RIP to know about a topology change and select a different path is a matter of minutes sometimes. Also, in order to be more accurate, it tends to be a very conservative protocol and so in the presence of a redundant topology like this one with loops in order to avoid packets from traveling around the network. Following the loop it will set a maximum cost of 15 for any path in the network; 16 is considered unreachable.
Those costs are measured in hop counts or the number of routers to go through along a certain path. This makes it less effective in selecting the best path in the presence of this redundant topology. The one hop path across that slower link will be selected, whereas the three-hop path would be faster but would not be selected. Even though a maximum of 16 equal cost paths can be selected, which is good in terms of load balancing, this routing protocol suffers from some inherent features that make it a less efficient, for example, periodically advertising every 30 seconds.
RIPv1 and RIPv2 Comparison
In an effort to improve RIP, designers came up with a second version of the protocol, RIP version 2. Several improvements were made to make this a classless routing protocol, which means it supports variable length subnet masks because the masks are advertised along with the routing update. This also makes RIP version 2 a protocol that can summarize routes. Other efforts were made to make it more efficient and so the advertisements are made on a multicast address and not as a broadcast.
With more security in mind, the protocol also supports router-to-router authentication, which means routers will not exchange routing information unless they share a common secret. Still, RIP version 2 is a distance vector protocol and it suffers from similar convergence issues. It still frequently advertises every 30 seconds and it still suffer from the maximum hop count of 16 for any network.
IP Routing Configuration Tasks
One of the good news about routing protocols is that their configuration is fairly consistent across the board in Cisco IOS routers. They follow similar steps. You first need to select the routing protocol and enable it in global configuration mode and then define the networks that you want this routing protocol to advertise on and receive advertisements through.
In the end, this is going to become advertisements coming in and out of interfaces, but the configuration is based on the network numbers configured on those interfaces. Remember, some routing protocols are classful and so they will not understand subnets, and this means that by enabling the routing protocol in a certain major network, you may be enabling the routing protocol on multiple interfaces that are simply subnets of the same major network.
So as we see here the basic commands to enable something like RIP in certain networks; similar steps will be necessary for other routing protocols. The command router enables the routing protocol process and at this time we are using RIP, but you could be using OSPF or EIGRP with the same command. With that, you enter routing protocol configuration mode.
Enter configuration commands, one per line. End with CNTL/Z.
For RIP, we are enabling RIP version 2 just to make sure that we are dealing with a classless routing protocol and to obtain the advantages of the more efficient RIP version 2.
The third command defines the networks directly connected to this router that will be participating in the RIP process. Even though RIP version 2 is a classless protocol, its configuration follows a classful criteria and so the network you specify there is a major classful network number.
RIP Configuration Example
So it becomes your job to look at the router’s interfaces, understand the network IDs attached or assigned to those interfaces, and then enable the protocol on those networks. In this example, for router A, this device is attached to networks 10 and 172.16 and so we enable the protocol on those two classful networks. Notice that B is connected only to networks that belong to the major classful network 10 and so we need only one command there, network 10.0.0.0, and that is going to enable the protocol on all interfaces that belong to that network 10, in this case, both serial interfaces.
There is a similar configuration for router C. Now in that router C, we had another link on network 10 and we do not want RIP running there; we would be running it with that network statement. The meaning of the network statement then is to enable the protocol on any and all interfaces that match the major network specified in the statement.
Verifying the RIP Configuration
Several commands are available to verify the configuration. Other than show running, you can see more live definitions of how RIP is configured and working by using the show IP protocols command. The output shows general information on the current timers being used by RIP and any routing filter that you may have applied. In terms of the network statement, the routing for networks section will display the exact networks that you configured the routing protocol for. So this means that we have two network statements, one for network 10 and one for network 172.16. The impact of that in the case of router A is that those two interfaces are now advertising and receiving advertisement for RIP. Fa0/0 belongs to network 172.16 and S0/0 belongs to network 10; both are sending and receiving RIP version 2 advertisements.
RouterA#show ip protocols
Routing Protocol is "rip"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Sending updates every 30 seconds, next due in 15 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Default version control: send version 2, receive version 2
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 2 2
Serial0/0 2 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
Routing Information Sources:
Gateway Distance Last Update
10.1.1.2 120 00:00:24
Distance: (default is 120)
Displaying the IP Routing Table and Troubleshooting
The main responsibility of any routing protocol is to populate the routing table, and so displaying the routing table is a good troubleshooting and verification approach. The output here belongs to router A again and we can see all the entries or routes being learned via RIP by looking at the first column. This piece will have information on the protocol that advertised the route.
RouterA#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, FastEthernet0/0
10.0.0.0/24 is subnetted, 2 subnets
R 10.2.2.0 [120/1] via 10.1.1.2, 00:00:16, Serial0/0
C 10.1.1.0 is directly connected, Serial0/0
R 192.168.1.0/24 [120/2] via 10.1.1.2, 00:00:16, Serial0/0
If you look at the legend up there, then you will see the different letters associated to each protocol. Through this output, we also know that the administrative distance of RIP is 120 and that the cost to get to that particular destination is the second number within brackets. 10.2.2.0 is one hop away, while 192.168.1.0 is two hops away. The timer there indicates the amount of time since the route was updated. Remember, RIP will advertise every 30 seconds and if it misses one route in one of the advertisements, it will flag it as possibly down.
If you want to see live RIP advertisements, you can use the debug IP RIP command. You can see how in this example for router A the router is sending advertisements on both interfaces to a broadcast destination. It is also receiving updates coming from B on 10.1.1.2 through the serial interface. In both cases, the routes being learned and advertised are part of the output of the command as well as the cost to reach each destination. This is a very powerful tool to verify whether your neighbors are running the protocol or whether they have filters that may be blocking certain networks or whether you made mistakes in enabling the protocols on certain interfaces.
RouterA#deb ip rip
RIP protocol debugging is on
00:16:59.871: RIP: received v2 update from 10.1.1.2 on Serial0/0
00:16:59.875: 10.2.2.0/24 via 0.0.0.0 in 1 hops
00:16:59.875: 192.168.1.0/24 via 0.0.0.0 in 2 hops
00:17:00.747: RIP: sending v2 update to 126.96.36.199 via Serial0/0 (10.1.1.1)
00:17:00.747: RIP: build update entries
00:17:00.747: 172.16.0.0/16 via 0.0.0.0, metric 1, tag 0
00:17:22.779: RIP: sending v2 update to 188.8.131.52 via FastEthernet0/0 (172.16.1.1)
00:17:22.779: RIP: build update entries
00:17:22.779: 10.0.0.0/8 via 0.0.0.0, metric 1, tag 0
00:17:22.783: 192.168.1.0/24 via 0.0.0.0, metric 3, tag 0
00:17:28.907: RIP: received v2 update from 10.1.1.2 on Serial0/0
00:17:28.911: 10.2.2.0/24 via 0.0.0.0 in 1 hops
00:17:28.911: 192.168.1.0/24 via 0.0.0.0 in 2 hops
All possible debugging has been turned off