Networking 101: Understanding RIP Routing

RIP has its share of detractors, but as one of the oldest and simplest routing protocols, understanding it is key to to understanding routing.

By Charlie Schluting | Posted May 25, 2006
Page of   |  Back to Page 1
Print ArticleEmail Article
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn

Welcome to the heart of networking: the routing protocols. We begin our series of looks at these protocols with one of the originals, and the most simple: RIP, the Routing Information Protocol.

RIP, like all routing protocols, is designed to disseminate network information pertinent to routers. At the most basic level, routers need to know what networks are reachable and how far away they are. RIP does this, and it’s still widely used today. In fact, we received feedback regarding last week’s Routing Overview from a reader who happily uses RIP at the ISP he works for.

Many people have nasty things to say about RIP. They say it converges slowly, it doesn’t scale, it’s insecure because authentication is only plain text, and it suffers from split-horizon issues. This is all true, but it’s still very useful. We hope this article will shed some light on these issues, and help you understand one of the most widely used interior gateway protocols (IGPs) out there.

RIP comes in two flavors: version one and version two. RIPv1 is very limiting because it doesn’t support CIDR addressing. This means it is classfull only, and you can’t slice up, for example, a /24 space into smaller units. RIPv1 also uses broadcast to send its information, which means that hosts can’t ignore RIP advertisements. Remember that each time a broadcast is sent, every host in the broadcast domain will receive an interrupt, and it must process the packet to determine if it’s something it cares about. RIPv2 uses multicast, which will be covered in a future installment of Networking 101. For now, just trust that hosts can ignore multicast without having to process the packet.

Remember, we said that RIP is a distance-vector protocol. The distance part is referring to the hop count in RIP, and the vector is the destination. Other distance-vector protocols may use other criteria for the vector, like an AS path in BGP. Both RIP flavors send their information every 30 seconds to UDP port 520. But what do they send? If you assumed “their routing information” you are correct. It can send specific information about networks it can reach, and also advertise itself as the default gateway (by sending 0.0.0.0 with a metric of 1).

The RIPv2 packet contains headers, just like any other protocol. Note that RIP is above UDP, so it is essentially an application-layer protocol. Every RIP packet contains a command, a version number, and a routing domain. Then up to 25 routes will follow in the same packet.

The Command
A RIP command is either a request or a response. When hosts, either a Unix box running gated or a router, first boot, they need to obtain routing information somehow. The “request” is just that, a request broadcast to ask for a routing table. The “response” is a normal RIP message, which will be in response to a request, or simply broadcast every 30 seconds.

The Version Number
The version number is either one or two.

The Routing Domain
A routing domain in RIP is an identifier used to specify the routing instance. More than one set of RIP instances can exist on the same network by specifying that a message be only intended for only people in a specific domain.

The Rest of the Packet
Then the real RIP information starts. This contains up to 25 routes, which entail the following information:

  • Network Address: to identify the start of the network.
  • Netmask: to say how large the network is.
  • Next-hop IP Address: i.e. the router that can get you there.
  • Metric: how many hops away this network is.

An important characteristic of RIP is that it will tell you about networks it heard from other people. You may hear these types of routing protocols called “routing by rumor.” The way this works is that the metric field is incremented before a router broadcasts a RIP packet. If router A tells you that it can get you to router B in two hops, then you know router A can talk directly to B, because it’s only one hop away. Ergo, router A has a link in the same broadcast domain as router B, but you do not.

When the metric, or hop count, reaches 16 you’re in trouble. The number 16 means infinity in RIP. Infinity being equal to 16 is a mechanism used to stop the problem of “count to infinity.” This happens because of the “routing by rumor” design. This can get tricky, but bear with this three-router example:

Router A knows that it can get to router C in two hops, via B. The picture in your mind should involve a straight line with B in the middle, and A and C on the ends. Now, since B has a direct connection to C, it will know when C goes down. But before B gets a change to tell A about C being down, A chimes in with a RIP update, which will include “I can get to C in two hops!” Router B will of course believe A, which means it thinks that A can get to C. Of course, A cannot, since its path was through B. But B doesn’t know this, because the only information in RIP is the next-hop address, which is A. Finally, when B sends his next update, he will include the route to C, which is now 3 hops. A believes B, because after all, B was the only way to C. This happens a few more times, and we’re at 16. The route is dropped instead of this continuing forever.

How is this problem solved? Not with a distance-vector protocol. When we “tell our neighbors about the world” without providing detailed information about each network, count to infinity is possible. Link-state protocols provide an entire view of the network to all routers, and avoid this issue. "Split-horizon" is another method that will help obviate this bug, but it is flawed as well.

Split-horizon means we would keep track of the interface an update came in on, and pay attention to updates from other routers that could conflict. This helps, but similar situations to the one above can still exist, when more routers are involved. That example gets really complex, but if you’re interested in RIP, feel free to invent a scenario in which count-to-infinity could happen, even with split-horizon capabilities.

The final “issue” with RIP is that it converges slowly. This is true, mostly because of the 30-second wait between updates, but in smaller organizations it doesn’t matter. RIPv2 is implemented on nearly all hardware, even those cheap “home routers” that you buy to NAT a broadband connection. Even if you don’t use RIP exclusively as an IGP, it’s still useful to know about because hosts can use it as well, as an alternative (or supplicant) to manually configuring a default gateway. Finally, if you’re small enough to be using all static routes, RIPv2 is sure to help make your life easier.

Comment and Contribute
(Maximum characters: 1200). You have
characters left.
Get the Latest Scoop with Enterprise Networking Planet Newsletter