After Hours

RIP explained: The gory details

The simplicity of the RIP protocol comes with the cost of fewer advanced features. Because of this, it is best to know exactly what the protocol is and where it is best employed. Lance Cockcroft explains, in gory detail, the RIP protocol.

Routing Information Protocol (RIP) is the oldest and most used routing protocol today. There are two versions of RIP: v1 and v2. Version 1 is the most-deployed version, since it is compatible with all RIP-capable devices. RIP evolved from the Gateway Information Protocol, which was part of the original Xerox Network Systems (XNS) protocol used on the very first Ethernet networks. XNS RIP was the predecessor for many distance vector routing protocols, including IP RIP, Novell’s IPX RIP, and AppleTalk’s Routing Table Maintenance Protocol (RTMP).

In this Daily Drill Down, I will explain the RIP protocol in detail. We’ll start with some history and then discuss the ways RIP works.

A bit of history
In the early 1980s, UNIX versions such as BSD began to include RIP daemons that allowed UNIX servers to act as network gateways and use RIP as their routing protocol. In 1988, RFC 1058 was written by Charles Hedrick. 1058 details RIP; however, the RFC was not written until after the RIP protocol was in widespread use. RFC 1058 is the only RFC detailing the RIP protocol.

What is RIP?
RIP is a distance vector routing protocol that uses only the hop count as its metric to determine the best path from source to destination. It is a very simple protocol to use and understand; however, its simplicity comes at the cost of not having some of the more advanced features and abilities of today’s more modern routing protocols.

Depending on whom you talk to, RIP can be considered a godsend or a protocol undeserving of its popularity. The truth is that RIP is a very good all-around routing protocol for the small internetwork, but it’s not the best protocol for large enterprise networks. Think of the saying “using the right tool for the right job.” If someone tries to use RIP on a large network with many different paths and over 16 hops, they will find RIP to be sorely lacking. However, if RIP is used on a small 5-10 router network that changes frequently, it will work efficiently, saving the administrator the labor of adding static routes each time the network changes.

Enabling RIP on a Cisco router
RIP can be enabled on a Cisco router by entering router configuration mode from configuration mode. You must be in exec mode to perform the following commands:
RouterA(config)# router rip
RouterA(config)# network
RouterA(config)# network

Believe it or not, this is all that is required to enable and configure RIP on a Cisco router. The router rip command changes the mode to router protocol configuration mode. This command must be entered each time changes to the RIP configuration are made. The network command actually tells the router which connected network(s) are to be advertised, as well as the router interface(s) that you want to participate in the RIP process. RIP version 1 is a classful routing protocol; therefore, any interfaces that belong to the classful network number used in the network command will participate in the RIP routing protocol. Classful routing will be discussed later.

What if you want to advertise a specific network number, but you do not want RIP advertisements to be sent out a particular interface? In other words, you want an interface to listen to RIP advertisements but you do not want it to send advertisements. Cisco has a special command for this situation. Within router configuration mode, simply use the passive-interface command:
RouterA(config)# router rip
RouterA(config)# passive-interface ethernet0

Routing by rumor
RIP’s typical operation uses two types of packets: request packets and response packets. When a RIP-enabled router is first started, the router sends request packets out all RIP interfaces to the broadcast address All RIP packets, whether they are request or response packets, use UDP (port 520) as the Transport layer protocol. All RIP-enabled routers will respond to the request packets by sending response packets.

Response packets contain the contents of each router’s routing table. The response packet can contain up to 25 routes. Response packets are only received by directly connected routers and are not forwarded. Since each router only speaks to its neighbors, we say that RIP routes by rumor. Networks are learned only from neighbors, not necessarily from the router that is directly connected to the network. Each route sent in response packets includes the network address and the metric associated with the network address.

Think of the response packet as a message telling the requesting router “these are the networks that I know how to get to.” A router receiving a response packet will process the packet by analyzing the routes included and adding routes to new networks to its routing table or changing routes to existing networks if the routes have lower metrics (fewer hops). The router will add one to the metric, since each advertising router advertises its own metric (hop count) to a destination. For example, if router A receives an update from router B containing a route with a metric of 2, router A will add the route to its routing table, list router B as the next hop for that network route, and record a metric of 3 to account for the hop between router A and router B.

If router B advertises network(s) that router A already has a route for, router A will simply discard the advertisement, unless router B has a lower metric to the destination network. A directly connected network has a hop count of 0, just as a network connected to a directly connected router has a hop count of 1. A hop count of 16 is considered unreachable.

To fully understand how RIP operates, let’s look at a simple network (see Figure A). Router C advertises its network,, to router B. Router B adds to its own routing table with a metric of 1 and a next hop address of Router B then advertises its own routing table to router A and router C. Router A learns from router B about networks and Router A adds network with a metric of 1 and network with a metric of 2. The next hop address for both of these networks is Router A now knows that it can send packets destined for network B or network C to router B for delivery.

Figure A
The RIP protocol works well with smaller networks.

A RIP-enabled router will send out response packets every 30 seconds. Once a router has received a route from a neighbor, it will expect to receive response packets from that router every 30 seconds. Additionally, a router will expect to see the same routes advertised each time from a responding router. If a router stops advertising a network route or if the metric to that network route changes, the receiving router will temporarily change the metric of that network route to 16. Consider Figure B. Router A has received a route to network D ( from router B with a metric of 1. Router A increments the metric to 2 and adds the network route to the routing table. If router B loses the link between itself and router D, it will update its routing table to reroute packets through router C. Router B will continue to advertise network D ( to router A; however, the advertised metric will now be 2. Router A will see that the metric has changed and will temporarily change the network route to unreachable (metric 16) to prevent routing loops (these will be discussed later). Once the timers have expired, router A will accept the new advertised metric from router B.

Figure B
Router A must rely on the other routers to figure out the best path to Router D.

If router B were to stop advertising network D, router A would remove the entry for network D from the routing table. Any packets received with a destination of 192.168.7.x would be discarded, and an ICMP destination unreachable message would be sent back to the source address.

RIP timers
As you have read, the RIP protocol should send out the contents of its entire routing table every 30 seconds because the default value for the update interval is 30 seconds. You can force the routers to update less frequently by increasing the update interval or force them to update more often by decreasing the update interval. All routers participating in the RIP routing process must be configured with the same update interval.

Only the router’s neighbors receive these advertisements. These neighbors expect these advertisements every 30 seconds, by default, with the same network route entries. If a router does not receive an advertisement for a route in 180 seconds, the route is marked as unreachable (given a metric of 16). Cisco calls this timer the invalid timer; however, it is also called the expiration timer or simply the timeout. The route will remain in the routing table for an additional 60 seconds beyond the invalid timer. The flush timer will then expire and will force the route to be flushed (removed) from the routing table. The flush timer is sometimes called the garbage collection timer. Within the Cisco IOS, it is known as the flush timer. The Cisco timers and their defaults are shown in Table A.

Table A
Timer Cisco default RFC 1058 default
Update 30 seconds 30 seconds
Invalid 180 seconds 180 seconds
Flush 60 seconds 120 seconds
The only timer default that differs is the Flush timer.

Timers should only be changed if the effects of such a change are thoroughly understood. To change the default value for the timers, use the command timers. The syntax for the timers command is:
timers basic update invalid holddown flush
RouterA(config)# router rip
RouterA(config)# timers basic 60 360 360 420

The invalid timer should be at least three times the update interval, and the flush timer must be greater than the invalid timer. Normally, the default values are best left in effect for standard operations.

One of the drawbacks of RIP is the amount of time that it takes for a network to converge in the event of a failure. Convergence, as you may recall, is the amount of time it takes for all routers on an internetwork to become aware of a network change. If the power to router C were to fail, how long would it take before all routers were aware of the change? Router B would stop receiving updates from router C and, after 30 seconds, would mark the route as unreachable. Router C would also mark the route as unreachable. Router B would also advertise network D as unreachable in its own advertisements so router A would learn that network D was unreachable. After 240 seconds, router B would flush the entry from the router table. It would take three to four minutes before all the routes were removed from the routing tables. In comparison, OSPF would have detected the error and converged in one minute or less.

RIP has provided many years of trouble-free dynamic routing for thousands of networks. Although it does not provide the speed and agility of more modern routing protocols, RIP still remains a practical and viable dynamic routing protocol solution for today’s small internetworks. In my next Daily Drill Down on RIP, I will discuss some of the more complicated aspects of RIP, such as loop avoidance, classful routing, and how to modify RIP’s default metrics.

Editor's Picks

Free Newsletters, In your Inbox