Home > RIP Tutorial

RIP Tutorial

February 3rd, 2011 Go to comments

In this tutorial we will learn about RIP routing protocol

Routing Information Protocol (RIP) is a distance-vector routing protocol which is based on Bellman-Ford algorithm. Routers using Distance Vector routing protocols do not posses the topological information about the network but instead rely on the neighbors information (so this method is known as routing by rumor). RIP sends the complete routing table out to all active interfaces every 30 seconds. RIP only uses hop count (the number of routers) to determine the best way to a remote network.

Note: RIP v1 is a classful routing protocol but RIP v2 is a classless routing protocol.

Classful routing protocols do not include the subnet mask with the network address in routing updates, which can cause problems with discontiguous subnets or networks that use Variable-Length Subnet Masking (VLSM). Fortunately, RIPv2 is a classless routing protocol so subnet masks are included in the routing updates, making RIPv2 more compatible with modern routing environments.

Distance vector protocols advertise routing information by sending messages, called routing updates, out the interfaces on a router.

RIP Operation

A big problem with distance vector routing protocol is routing loop. Let’s take a look at how a routing loop occurs.

Here we have routers A, B and C. Notice that at the beginning (when a routing protocol is not turned on) there are only directly connected networks in the routing tables of these routers. For example, in the routing table of router A, network 1.0.0.0 has already been known because it is directly connected through interface E0 and the metric (of a directly connected network) is 0 (these 3 parameters are shown in the routing tables below).

RIP_Distance_Vector_Protocol_Initial.jpg

Also B knows networks 2.0.0.0 & 3.0.0.0 with a metric of 0.
Also C knows networks 3.0.0.0 & 4.0.0.0 with a metric of 0.

Now we turn on RIP on these routers (we will discuss the configuration later. In the rest of this article, we will call network 1.0.0.0 network 1, 2.0.0.0 network 2 and so on).

RIP sends update every 30 seconds so after 30 sec goes by, A sends a copy of its routing table to B, B already knew about network 2 but now B learns about network 1 as well. Notice the metric we have here for directly connected networks, since we’re using RIP, we’re using a metric of hop count. Remember a hop count (or a hop) is how many routers that these packets will have to go through to reach the destination. For example, from router A to network 1 & 2 (which are directly connected) it goes to 0 hop, router B has now learned about network 1 from A via E0 interface so the metric now will be 1 hop.

RIP_Distance_Vector_Protocol_First_Update.jpg

Each router receives a routing table from its direct neighbor. For example, Router B receives information from Router A about network 1 and 2. It then adds a distance vector metric (such as the number of hops), increasing the distance vector of these routes by 1.

B also exchanges its routing table with A about network 2 and 3.

RIP_Distance_Vector_Protocol_Second_Update.jpg

B then passes the routing table to its other neighbor, Router C.

RIP_Distance_Vector_Protocol_Third_Update.jpg

C also sends its update to B and B sends it to A.

RIP_Distance_Vector_Protocol_Four_Update.jpg

Now the network is converged.

Now let’s assume network 4 down suddenly.

RIP_Distance_Vector_Protocol_Network_Down.jpg

When network 4 fails, Router C detects the failure and stops routing packets out its E1 interface. However, Routers A and B have not yet received notification of the failure. Router A still believes it can access 4.0.0.0 through Router B. The routing table of Router A still refects a path to network 10.4.0.0 with a distance of 2 and router B has a path with a distance of 1.

There will be no problem if C sends an update earlier than B and inform that network is currently down but if B sends its update first, C will see B has a path to network 4 with a metric of 1 so it updates its routing table, thinking that “if B can go to network 4 by 1 hop than I can go to network 4 by 2 hops” but of course this is totally wrong.

RIP_Distance_Vector_Protocol_Network_Down_2.jpg

The problem does not stop here. In turn, C sends an update to B and informs it can access network 4 by 2 hops. B learns this and think “if C can access network 4 by 2 hops than I can access by 3 hops”.

RIP_Distance_Vector_Protocol_Network_Down_3.jpg

This same process occurs when B continually sends its update to C and the metric will increase to infinity so this phenomenon is called “counting to infinity”.

Below lists some methods to prevent this phenomenon:

SPLIT HORIZON:
A router never sends information about a route back in same direction which is original information came, routers keep track of where the information about a route came from. Means when router A sends update to router B about any failure network, router B does not send any update for same network to router A in same direction.

ROUTE POISONING:
Router consider route advertised with an infinitive metric to have failed ( metric=16) instead of marking it down. For example, when network 4 goes down, router C starts route poisoning by advertising the metric (hop count) of this network as 16, which indicates an unreachable network. When router B receives this advertising, it continue advertising this network with a metric of 16.

POISON REVERSE:

The poison reverse rule overwrites split horizon rule. For example, if router B receives a route poisoning of network 4 from router C then router B will send an update back to router C (which breaks the split horizon rule) with the same poisoned hop count of 16. This ensures all the routers in the domain receive the poisoned route update.

Notice that every router performs poison reverse when learning about a downed network. In the above example, router A also performs poison reverse when learning about the downed network from B.

HOLD DOWN TIMERS:

After hearing a route poisoning, router starts a hold-down timer for that route. If it gets an update with a better metric than the originally recorded metric within the hold-down timer period, the hold-down timer is removed and data can be sent to that network. Also within the hold-down timer, if an update is received from a different router than the one who performed route poisoning with an equal or poorer metric, that update is ignored. During the hold-down timer, the “downed” route appears as “possibly down” in the routing table.

For example, in the above example, when B receives a route poisoning update from C, it marks network 4 as “possibly down” in its routing table and starts the hold-down timer for network 4. In this period if it receives an update from C informing that the network 4 is recovered then B will accept that information, remove the hold-down timer and allow data to go to that network. But if B receives an update from A informing that it can reach network by 1 (or more) hop, that update will be ignored and the hold-down timer keeps counting.

Note: The default hold-down timer value = 180 second.

TRIGGERED UPDATE :
When any route failed in network ,do not wait for the next periodic update instead send an immediate update listing the poison route.

COUNTING TO INFINITY:
Maximum count 15 hops after it will not be reachable.

RIP Timers

RIP uses several timers to regulate its operation. These timers are described below:

Update timer: how often the router sends update. Default update timer is 30 seconds
Invalid timer (also called Expire timer): how much time must expire before a route becomes invalid since seeing a valid update; and place the route into holddown. Default invalid timer is 180 seconds
Holddown timer: When a route is expired, it enters “holddown”, which means the router will not believe any new updates with a hop count equal to or higher (poorer) than the hop count recording in the routing table. Hold down is intended to assist in avoiding inaccurate routing by rumor information while the network converges. Default holddown timer is 180 seconds
Flush timer: how much time since the last valid update, until RIP deletes that route in its routing table. Default Flush timer is 240 seconds

RIP_timer.jpg

Note: From the image above, you can see that when a route expires, in fact the Holddown timer only works in its first 60 seconds (not 180 seconds), then the route is removed from the routing table when the Flush timer is expired.

Configuring RIP

Router(config)#router rip Enter router RIP configuration mode
Router(config-router)#network <address> Identify networks that will participate in the router protocol. Notice that you identify networks, and not interfaces.

NOTE: You need to advertise only the classful network number, not a subnet:
Router(config-router)#network 172.16.0.0
not
Router(config-router)#network 172.16.10.0

If you advertise a subnet, you will not receive an error message, because the router will automatically convert the subnet to the classful network address.

To learn more about configuring RIP, please read my Configuring RIP GNS3 Lab tutorial

Key points:

+ RIP uses hop counts to calculate optimal routes (a hop is a router).
+ RIP routing is limited to 15 hops to any location (16 hops indicates the network is unreachable).
+ RIP uses the split horizon with poison reverse method to prevent the count-to-infinity problem.
+ RIP uses only classful routing, so it uses full address classes, not subnets.
+ RIP broadcasts updates to the entire network.
+ RIP can maintain up to six multiple paths to each network, but only if the cost is the same.
+ RIP supports load balancing over same-cost paths.
+ The update interval default is 30, the invalid timer default is 180, the holddown timer default is 180, and the flush timer default is 240.

Comments (50) Comments
Comment pages
1 2 3 4 443
  1. momochii
    May 3rd, 2011

    It’s really a nice and helpful piece of information. I’m glad that you shared this helpful info with us. Please keep us informed like this. Thanks for sharing.

  2. ken zuobai may10th,2011
    May 11th, 2011

    this is very beautiful,but pls am preparing for the ccna exams,where can i get a concise book to read and latest dumps,pls send to kenbraebi@yahoo.com

  3. 9tut
    May 18th, 2011

    @ken zuobai: For recommended CCNA books, please read https://www.9tut.com/ccna-faqs-a-tips

  4. Anonymous
    July 1st, 2011

    This is really awsome i really likes this. It clears my doubt in RIP, Thanks for this article who has posted.

  5. Anonymous
    July 5th, 2011

    Excellent! Thank you for posting RIP article

  6. ozi
    July 10th, 2011

    wonderful skill you have to share. RIP my doubts… Thank you for that

  7. Amira
    July 14th, 2011

    @9tut:
    thank you very much for such a helpful tutorial, and i think it will be perfect if you give examples that discuss:
    “+ The update interval default is 30, the invalid timer default is 180, the holddown timer default is 180, and the flush timer default is 240.

    thank you

  8. Haidar
    July 23rd, 2011

    WoW! Lots of thanks! It really does clarify all doubts in a beautiful and smooth way.

  9. Amen
    July 29th, 2011

    Hi, great explanation.

    I have one question though.In ur explanation about route poisining,” If it gets an update with a better metric than the originally recorded metric within the hold-down timer period, the hold-down timer is removed and data can be sent to that network.” I am not clear why hold timer is removed. I think the main purpose of hold down timer is to prevent that route from reinstating.With rip,reinstating is posible only during invalid time period.

  10. 9tut
    July 29th, 2011

    @Amen: The main purpose of the hold down timer is to give more time for the knowledge of the change to propagate through the entire network.

    If the router receives an update with a poorer metric than the metric of originally recorded network then that router can’t claim the route is up again because that update can be false (because that update can be created by loop). It is the reason why that “poorer” update is dropped in the hold down timer.

    But if the router receives an update with a better metric then surely there is an alternative path to reach that network. So the hold down timer can be removed.

  11. Amen
    July 29th, 2011

    Thanks 9tut,

    How do u see this explanation “The router accepts no updates for the route until the holddown timer expires.”

  12. 9tut
    July 30th, 2011

    @Amen: That explanation is not correct. The router does accept better metric route in the hold-down timer.

  13. AneeshMohan
    August 23rd, 2011

    very nice notes

  14. Anonymous
    August 23rd, 2011

    @kelly can u send me the Dumps…
    my mail id – pratik_b88@yahoo.in

  15. Darwin
    August 29th, 2011

    Thanks 9tut.Although I have read RIP in Cybex, I couldn’t understand well.Only when I read this forum, I become understand deeply.Looking forward more posts.

    With regards

  16. enthusiast
    September 12th, 2011

    Awesome!! Thanks, you are just great!!!!!!!!!!!

  17. Jad
    September 13th, 2011

    Hello 9tut. Is there any printable version for the tutorial pages ? Thanks, Great job

  18. prema
    September 13th, 2011

    very simple and nice explanation.better than todd lammle and wendel odom.can you please add some explanation about “debug ip rip “command ,which is very important for the CCNA exam.Thanks in advance.Also I see people talking about dumps…is it really useful…I never had a chance to see dumps.Is it a good advice to see dumps ?

  19. g suman
    October 2nd, 2011

    thanx .i have cleared all doubts in routing loops.thank again for such a good tutorial.

  20. Ayman
    October 3rd, 2011

    Very clear and nice demostration

  21. Isabe
    October 5th, 2011

    I just found this web site. I like it alot. I’ve been seeing the term “dumps”. What is that? Is it practice questions?

  22. norman
    October 10th, 2011

    very informative site…i like it very much

  23. Lan
    October 27th, 2011

    9tut u guya are good

  24. Vishwanath
    November 11th, 2011

    Very nice and informative notes. So nice example to understand routing loop.
    Thanx very much for sharing.

  25. Anonymous
    November 18th, 2011

    Thank you very much for this detailed information

  26. abdibasid
    November 25th, 2011

    @9tut

    please what the router will assign the failed network when the hold down timer is finished , we know with in the hold down timer the failed network is assigned “possibly down”.

  27. 9tut
    November 26th, 2011

    @abdibasid: The router will assign a metric (hop count) of 16 to that route to indicate that route is down (not accessible).

  28. nizam
    December 12th, 2011

    Hats off to the explanation. Clear cut and lovely explained. One who cannot understand after this explanation then he or she should not do networking.

  29. Bala
    December 15th, 2011

    Good explanations…Thanks 9tut

  30. Drei
    January 26th, 2012

    Best explanation I’ve seen! Donated $$ and will donate more to keep the site alive!

  31. jeet
    February 1st, 2012

    Note: The default hold-down timer value = 180 second.

    Have confusion on this, if default hold time is 180 seconds not 90 than what wud be default timeout

    Is the table below incorrect–

    update timer: 30 seconds
    hold timer-90 seconds
    time out-180
    flush timer-120 seconds

  32. ccna
    February 13th, 2012

    @jeet
    I think it’s correct.
    Cisco IOS Release 12.0 Network Protocols Command Reference, Part 1
    http://www.cisco.com/en/US/docs/ios/12_0/np1/command/reference/1rrip.html#wp1018019

    Defaults

    update is 30 seconds
    invalid is 180 seconds
    holddown is 180 seconds
    flush is 240 seconds

  33. Usmaan
    February 14th, 2012

    Also within the hold-down timer, if an update is received from a different router than the one who performed route poisoning with an equal or poorer metric, that update is ignored. <> But if B receives an update from A informing that it can reach network by 1 (or more) hop, that update will be ignored an the hold-down timer keeps counting.

    How is it not a better metric suggested by Router A to Router B ?

    What i understand from this is that Poorer metric are those with Higher Hop numbers.

    In that case Update from Router A should have been accepted by Router B no?

    @9tut

    thanks

  34. 9tut
    February 16th, 2012

    @Usmaan: Router B learned it could reach network 4 by 1 hop (via router C). So router A can’t advertise a better metric in this case. In the best situation, router A is directly connect to network 4, it still advertises to router B that it can reach via 1 hop (equal the metric advertised by C) -> the update is still ignored because an equal metric is not good enough to remove the hold-down timer.

  35. miribeni
    March 22nd, 2012

    Thank you very munch for sharing.

  36. saurabh
    April 2nd, 2012

    Thanxx…9tut

  37. Jelenna
    April 29th, 2012

    If some network goes down, does router start INVALID timer, and after that 180 seconds sends update with metric 15 to that network? In which situation router wait for invalid timer to declare route to network? If I understood well, if network goes down, router send immediately triggered update to inform others… So I’m confused, in which situation will it wait for invalid timer?

  38. janjo
    May 7th, 2012

    @9tut

    best website! thanks!

  39. janypogs
    May 8th, 2012

    Dear all,

    you may also want to check below site for some useful resources. Good luck to all of us!

    careercert.info

  40. kafeel
    June 5th, 2012

    Can you please post the correct answer to the following question.

    How long would it take to flush the route that has been marked invalid? If all timers are at defaults.

    Thanks a million

  41. kafeel
    June 5th, 2012

    Dear 9TUT,

    Please explain the debug ip rip output. What do the lines in output mean.

    Many Thanks

  42. Shr
    June 6th, 2012

    Very valuable information

  43. Shr
    June 6th, 2012

    Thank u very much

  44. @m0l
    June 23rd, 2012

    thnk u so much

  45. prashant
    July 10th, 2012

    Awasome! i have never seen such a good kind of explanation!
    Thanks alot!!!!!

  46. Please Explain
    July 18th, 2012

    Hi All,

    Can somebody explain the Serial0 interface? Is it the interface define in 172.20.2.1? Thanks

    R 172.20.1.0 [120/2] via 172.20.2.1, 00:00:04, Serial0

  47. geedub
    August 6th, 2012

    I took the exam and I had a 800 — passing 825 — this site is more like the test than others
    — it was a matter of time for me — some things I am very quick at and others it takes me a while to calculate — so — practice timing yourself —- and practice packet tracers — be able to make the decision on what command to send and know the correct command — if you understand most things — just learn to speed up — you dont have time to make mistakes

  48. bite
    August 15th, 2012

    @please explain

    that means your router is connected to that network containing this ip 172.20.2.1 (depending on the subnet mask ) and serial interface other end is connected to 172.20.2.1 (not on the router you typed #sh ip route.

    Serial 0 is the router interface you did ( #sh ip route.)

  49. bite
    August 15th, 2012

    @9tut can you please explain the output od debug ip rip.

    I am cracking my head over some issue say….
    A router R1 is connected to other two others routers R2 and R3. when I see

    RIP:Build update entries

    (say) 192.168.1.0 0.0.0.0 metric 1, tag 0

    BUT 192.168.1.0 is directly connected why is it still saying Metric 1?????

    Please explain!!! I have already wasted a day on this!!

  50. kushal arora
    August 16th, 2012

    THNX 9TUT !! ..ITS PRETTY COOL INFO. ABT RIP…!! ;) THNK UUU VERY MUCH !

Comment pages
1 2 3 4 443
Add a Comment