While static routes provide a method for giving the router information about where networks are located so that they can route packets, they are not scalable. For that information you need to use a dynamic routing protocol. While a lot of different routing protocols exist, the Routing Information Protocol (RIP), which is a distance vector routing protocol, is one of the most enduring of all routing protocols. RIP is a relatively old, but still commonly used, interior gateway protocol created for use in small, homogeneous networks. RIP is also very useful for understanding how dynamic routing protocols operate. This section describes the basic features and operation of RIP and explains how to enable RIP on an IP network.
Dynamic Routing Protocol Overview
A routing protocol defines the rules that are used by a router when it communicates with neighboring routers. Dynamic routing relies on a routing protocol to disseminate knowledge. In contrast, static routing defines the format and use of the fields within a packet. Packets are generally conveyed from end system to end system. Figure 5-38 shows how a router uses a routing protocol to learn the locations of other networks.
Figure 5-38 Routing Protocols Learn about Networks
Further examples of the information that routing protocols describe are as follows:
- How updates are conveyed
- What knowledge is conveyed
- When to convey knowledge
- How to locate recipients of the updates
Figure 5-39 shows the two types of routing protocols, Interior Gateway Protocols and Exterior Gateway Protocols.
Figure 5-39 Routing Protocol Types
- Interior Gateway Protocols (IGP): These routing protocols are used to exchange routing information within an autonomous system. Routing Information Protocol version 1 (RIPv1), RIPv2, EIGRP, and Open Shortest Path First (OSPF) are examples of IGPs.
- Exterior Gateway Protocols (EGP): These routing protocols are used to connect autonomous systems. An autonomous system is a collection of networks under a common administration and sharing a common routing strategy. Border Gateway Protocol (BGP) is an example of an EGP.
NOTE The Internet Assigned Numbers Authority (IANA) assigns autonomous system numbers for many jurisdictions. Use of IANA numbering is required if your organization plans to use an EGP, such as BGP. However, it is good practice to be aware of private versus public autonomous system numbering schema.
In addition to types like RIP, OSPF, etc., routing protocols can further be classified as to how the routing protocols operate, as shown in Figure 5-40. In an autonomous system, most IGP routing algorithms can be classified as conforming to one of the following algorithms:
- Distance vector: The distance vector routing approach determines the direction (vector) and distance (hops) to any link in the internetwork.
- Balanced hybrid: The balanced hybrid approach combines aspects of link-state and distance vector algorithms.
- Link state: The link-state approach, also known as the shortest path first (SPF) algorithm, creates an abstraction of the exact topology of the entire internetwork, or at least of the partition in which the router is situated.
Figure 5-40 Routing Protocol Algorithms
No single best routing algorithm exists for all internetworks. Each routing protocol provides information differently.
Features of Dynamic Routing Protocols
Multiple routing protocols and static routes can be used at the same time. If several sources for routing information exist, an administrative distance value rates the trustworthiness of each routing information source. By specifying administrative distance values, Cisco IOS software can discriminate between sources of routing information.
Example: Administrative Distance
An administrative distance is an integer from 0 to 255. A routing protocol with a lower administrative distance is more trustworthy than one with a higher administrative distance. As shown in Figure 5-41, if router A receives a route to network E from EIGRP and RIP at the same time, router A uses the administrative distance to determine that EIGRP is more trustworthy. Router A would then add the EIGRP route to the routing table.
Figure 5-41 Administrative Distance
Table 5-6 shows the default administrative distance for selected routing information sources.
Table 5-6 Default Administrative Distances
If nondefault values are necessary, you can use Cisco IOS software to configure administrative distance values on a per-router, per-protocol, and per-route basis.
Classful Routing Versus Classless Routing Protocols
Routing protocols are also identified by how they handle IP address space. RIP version 1 is a classful routing protocol. Classful routing is a consequence of the fact that subnet masks are not advertised in the routing advertisements that are generated by most distance vector routing protocols.
When a classful routing protocol is used, all subnetworks of the same major network (Class A, B, or C) must use the same subnet mask. Routers that are running a classful routing protocol perform automatic route summarization across network boundaries. Upon receiving a routing update packet, a router that is running a classful routing protocol takes one of the following actions to determine the network portion of the route:
- If the routing update information contains the same major network number as is configured on the receiving interface, the router applies the subnet mask that is configured on the receiving interface.
- If the routing update information contains a major network that is different from that configured on the receiving interface, the router applies the default classful mask (by address class) as follows:
- For Class A addresses, the default classful mask is 255.0.0.0.
- For Class B addresses, the default classful mask is 255.255.0.0.
- For Class C addresses, the default classful mask is 255.255.255.0.
RIP version 2 is a classless routing protocol. Classless routing protocols can be considered second-generation protocols because they are designed to address some of the limitations of the earlier classful routing protocols. One of the most serious limitations in a classful network environment is that the subnet mask is not exchanged during the routing update process, thus requiring the same subnet mask to be used on all subnetworks within the same major network.
Another limitation of the classful approach is the need to automatically summarize to the classful network boundary at major network boundaries.
In the classless environment, the summarization process is controlled manually and can usually be invoked at any bit position within the address. Because subnet routes are propagated throughout the routing domain, manual summarization might be required to keep the size of the routing tables manageable. Classless routing protocols include RIPv2, EIGRP, OSPF, and Intermediate System-to-Intermediate System (IS-IS).
Distance Vector Route Selection
In addition to supporting both classful and classless routing, RIP can be characterized as a distance vector routing protocol. The periodic routing updates that most distance vector routing protocols generate are addressed only to directly connected routing devices. The addressing scheme that is most commonly used is a logical broadcast. Routers that are running a distance vector routing protocol send periodic updates even if no changes exist in the network.
In a pure distance vector environment, the periodic routing update includes a complete routing table. Upon receiving a full routing table from its neighbor, a router can verify all known routes and make changes to the local routing table based on updated information. This process is also known as “routing by rumor” because the router’s understanding of the network is based on the neighboring router’s perspective of the network topology. Figure 5-42 demonstrates how distance vector protocols operate.
Figure 5-42 Distance Vector Protocols
Example: Distance Vector Routing Protocols
Router B receives periodic routing updates from router A. Router B adds a distance vector metric (such as the hop count) to each route learned from router A, increasing the distance vector. Router B then passes its own routing table to its neighbor, router C. This step-bystep process occurs in all directions between directly connected neighbor routers.
Traditionally, distance vector protocols were also classful protocols. RIPv2 and EIGRP are examples of more advanced distance vector protocols that exhibit classless behavior.
EIGRP also exhibits some link-state characteristics.
In Figure 5-43, the interface to each directly connected network is shown as having a distance of 0.
Figure 5-43 Distance Vector Example
As the distance vector network discovery process continues, routers discover the best path to destination networks that are not directly connected, based on accumulated metrics from each neighbor. Neighboring routers provide information for routes that are not directly connected.
Example: Sources of Information and Discovering Routes
Router A learns about networks that are not directly connected (10.3.0.0 and 10.4.0.0) based on information that it receives from router B. Each network entry in the routing table has an accumulated distance vector to show how far away that network is in a given direction.
The key characteristics of RIP include the following:
- RIP is a distance vector routing protocol.
- Hop count is used as the metric for path selection.
- The maximum allowable hop count is 15.
- Routing updates are broadcast every 30 seconds by default.
- RIP is capable of load balancing over as many as 16 equal-cost paths. (Four paths is the default.)
Because of the characteristics of RIP, it always chooses the route with the least number of hops. This is not always, however, the best route, as is shown in Figure 5-44.
Figure 5-44 RIP Uses Hop Count
RIPv1 and RIPv2 Comparison
RIP has been around for a long time, but recently RIP version 2 was created to allow for more flexibility with addressing. Both routing protocols are still distance vector, but the versions have a number of differences. Table 5-7 outlines those differences.
Table 5-7 RIPv1 and RIPv2 Comparison
Defining the maximum number of parallel paths allowed in a routing table enables RIP load balancing. With RIP, the paths must be equal-cost paths. If the maximum number of paths is set to one, load balancing is disabled.
NOTE Cisco routers support RIPv1 and RIPv2. This course focuses on configuring RIPv2 only.
Dynamic Routing Configuration Tasks
To enable a dynamic routing protocol, you must complete the following steps:
Step 1 Select a routing protocol: RIP, EIGRP, or OSPF.
Step 2 Assign IP network numbers without specifying subnet values (except for OSPF).
You must also assign network or subnet addresses and the appropriate subnet mask to the interfaces.
The router rip command selects RIP as the routing protocol. The network command assigns a major network number that the router is directly connected to. The RIP routing process associates interface addresses with the advertised network number and begins RIP packet processing on the specified interfaces.
Figure 5-45 shows three routers to be configured to communicate their networks via RIP.
Figure 5-45 RIP Configuration
In the example, the router A configuration includes the following:
- router rip: Selects RIP as the routing protocol
- version 2: Enables RIPv2
- network 172.16.0.0: Specifies a directly connected network
- network 10.0.0.0: Specifies a directly connected network
The router A interfaces that are connected to networks 172.16.0.0 and 10.0.0.0, or their subnets, are to send and receive RIP updates. These routing updates allow the routers to learn the network topology.
Routers B and C have similar RIP configurations, but with different network numbers specified.
RIP Configuration Verification
The show ip protocols command displays values about routing protocols and the routing protocol timer information that is associated with the router. In the following example, you use the show ip protocols command to see that router A, in
Figure 5-46, is configured with RIP and sends updated routing table information every 30 seconds. (This interval is configurable.)
Figure 5-46 Sample RIP Network
If a router running RIP does not receive an update from another router for 180 seconds or more, it marks the routes that are served by that router as being invalid. Also, in this output you see that the hold-down timer is set to 180 seconds. As a result, an update to a route that was down and is now up stays in the hold-down (possibly down) state until 180 seconds have passed. If still no update occurs after 240 seconds (flush timer), the router removes the routing table entries from the router. The router is injecting routes for the networks that are listed following the “Routing for Networks” line. The router is receiving routes from the neighboring RIP routers that are listed following the “Routing Information Sources” line. The distance default of 120 refers to the administrative distance for an RIP route.
RouterA# show ip protocols
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 6 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
Default version control: send version 2, receive version 2
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 2 2
Serial0/0/2 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:25
Distance: (default is 120)
Table 5-8 describes the significant fields shown in the display
Table 5-8 RIP Verification Fields
In addition to the show ip protocols command, you use the show ip route command to display the routes known by router A as well as the methods by which it learned the routes and the last time it received an update. This is shown in the following example.
RouterA# show 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, * - candidate default
U - per-user static route, o - ODR
T - traffic engineered 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:07, Serial0/0/2
C 10.1.1.0 is directly connected, Serial0/0/2
R 192.168.1.0/24 [120/2] via 10.1.1.2, 00:00:07, Serial0/0/2
The routing table contains entries for all known networks and subnetworks, and a code that indicates how that information was learned. The output and function of key fields from the show ip route command are explained in Table 5-9.
Table 5-9 show ip route Command Output
If routing information is not being exchanged (that is, if the output of the show ip route command shows no entries that were learned from a routing protocol), use the show running-config or show ip protocols privileged EXEC commands on the router to check for a possible misconfigured routing protocol.
RIP Configuration Troubleshooting
Use the debug ip rip command to display RIP routing updates as they are sent and received. The no debug all command turns off all debugging.
RouterA# debug ip rip
RIP protocol debugging is on
00:06:24: RIP: received v1 update from 10.1.1.2 on Serial0/0/2
00:06:24: 10.2.2.0 in 1 hops
00:06:24: 192.168.1.0 in 2 hops
00:06:33: RIP: sending v1 update to 255.255.255.255 via FastEthernet0/0 (172.16.1.1)
00:06:34: network 10.0.0.0, metric 1
00:06:34: network 192.168.1.0, metric 3
00:06:34: RIP: sending v1 update to 255.255.255.255 via Serial0/0/2 (10.1.1.1)
00:06:34: network 172.16.0.0, metric 1
The following output indicates the source address from which updates were received:
RIP: received v1 update from 10.1.1.2 on Serial0/0/2
The following output indicates the destination addresses to which updates were sent:
RIP: sending v1 update to 255.255.255.255 via FastEthernet0/0 (172.16.1.1)
RIP: sending v1 update to 255.255.255.255 via Serial0/0/2 (10.1.1.1)
Example: debug ip rip Command
The example shows that the router being debugged has received updates from one router at
source address 10.1.1.2. That router sent information about two destinations in the routing
table update. The router being debugged also sent updates, in both cases to broadcast
address 255.255.255.255 as the destination. The number in parentheses is the source
address that is encapsulated into the IP header.
Other output that you might see from the debug ip rip command includes entries such as
RIP: broadcasting general request on FastEthernet0/0
RIP: broadcasting general request on FastEthernet1/0
RIP: bad version 128 from 18.104.22.168