April 25, 2019

Simple Dynamic Routing With RIP - page 2

Inside RIP

  • October 15, 2008
  • By Charlie Schluting
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:

More Networking 101

  • IP Addresses
  • Subnets and CIDR
  • Subnets
  • Layers
  • the Data Link Layer
  • Spanning Tree
  • ICMP
  • The Internet Protocol
  • TCP, the Protocol
  • TCP In More Depth
  • Internet Governance
  • Routing
  • 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.

    In a Nutshell
    • RIP is a distance-vector interior gateway routing protocol: it uses a hop count and next-hop router to specify routes.
    • RIPv1 is uses broadcast and doesn't support CIDR. RIPv2 is classless and uses multicast.
    • Even though it converges slowly and suffers from certain bugs, RIP is well-suited for small to medium environments.

    Article courtesy of Enterprise Networking Planet, originally published May 25, 2006.

    When he's not writing for Enterprise Networking Planet or riding his motorcycle, Charlie Schluting is the Associate Director of Computing Infrastructure at Portland State University. Charlie also operates OmniTraining.net, and recently finished Network Ninja, a must-read for every network engineer.

    Most Popular LinuxPlanet Stories