RIP Fundamentals
RIP is based on the Distance-Vector (DV) algorithm. RIP uses hop count (HC) to measure the distance to the destination. The distance is called the metric value. In RIP, the default HC from a router to its directly connected network is 0, and the HC from a router to a reachable network through another router is 1. That is, the HC equals the number of routers passed from the local network to the destination network. To speed up network convergence, RIP defines the HC as an integer that ranges from 0 to 15. An HC 16 or greater is defined as infinity, that is, the destination network or the host is unreachable. For this reason, RIP is not applied to large-scale networks.
RIP Routing Table
When RIP starts on a router, the RIP routing table contains only the routes to the directly connected interfaces. After neighboring routers on different network segments learn the routing entries from each other, they can communicate with each other.
- RIP starts, and then RouterA broadcasts Request packets to neighboring routers.
- When receiving the Request packet, RouterB encapsulates its own RIP routing table into the Response packet and broadcasts the Response packet to the network segment connected to the interface receiving the Request packet.
- RouterA generates a routing table based on the Response packet sent from RouterB.
RIP Update and Maintenance
RIP uses four timers to update and maintain routing information:
- Update timer: When this timer expires, a router immediately sends an Update packet.
- Age timer: If a RIP device does not receive an Update packet from a neighbor within the aging time, the RIP device considers the route unreachable.
- Garbage-collect timer: If a RIP device does not receive an Update packet of an unreachable route within the timeout interval, the device deletes the routing entry from the RIP routing table.
- Suppress timer: When a RIP device receives an Update packet with the Cost field being 16 from a neighbor, the route is suppressed and the suppress timer starts. To avoid route flapping, the RIP device does not accept any Update packet before the suppress timer expires even if the Cost field in an Update packet is smaller than 16. After the suppress timer expires, the RIP device accepts new Update packets.
Relationships between RIP routes and timers:
- The interval for sending Update packets is determined by the Update timer, which is 30 seconds by default.
- Each routing entry has two timers: age timer and Garbage-collect timer. When a RIP device adds a learned route to the local RIP routing table, the age timer starts for the routing entry. If the RIP device does not receive an Update packet from the neighbor within the age time, the RIP device sets the Cost value of the route to 16 (unreachable) and starts the Garbage-collect timer. If the RIP device still does not receive an Update packet within the Garbage-collect timer, the RIP device deletes the routing entry from the RIP routing table.
Triggered Update
When routing information changes, a device immediately sends an Update packet to its neighbors, without waiting for Update timer expiration. This function avoids loops.
- If RouterC does not support triggered update when detecting a link fault, it has to wait until the Update timer expires. If RouterC receives an Update packet from RouterB before its Update timer expires, RouterC learns a wrong route to network 10.4.0.0. In this case, the next hops of the routes from RouterB or RouterC to network 10.4.0.0 are RouterC and RouterB respectively. A routing loop is generated.
- If RouterC supports triggered update when detecting a link fault, RouterC immediately sends an Update packet to RouterB so that a routing loop is prevented.