RIP - Routing Information Protocol Explained

This tutorial explains the concept of distance-vector routing in detail. Learn what a distance and a vector are and how they are used by the RIP routing protocol to learn and advertise network paths.

In the distance-vector routing, routers learn the routing information from directly connected neighbors, and these neighbors may have learned these networks from other neighboring routers. Because of this, the distance-vector routing is also known as the routing by rumor.

In the following section, we will not only understand the distance-vector routing concept in detail through an example but will also understand how the RIP routing protocol uses this concept to learn and select the best route for each subnet of the network.

This tutorial is the second part of the article "How to configure RIP routing protocol explained with features and functions of the RIP protocol ". The first part of this article is the following.

How RIP Routing Protocol Works

This part explains how the RIP routing protocol uses broadcast messages to exchange network paths' information.

Distance-vector routing and RIP routing protocol

RIP routing protocol uses the concept of distance-vector routing. Routers running RIP protocol learn about the destination networks from neighboring routers through broadcast messages. Routers running RIP protocol periodically broadcast the configured networks from all ports. Listing routers update their routing tables from these broadcasts.

Let's understand this concept through an example.

The following figure illustrates a simple network running the RIP routing protocol.

rip routing exchange

When we start this network, the routers only know the IP subnets that are available on their local interfaces.

Router R1 knows the networks 10.0.0.0/8 and 192.168.1.252/30 are available on interfaces F0/1 and S0/0, respectively.

Router R2 knows the networks 192.168.1.252/30 and 192.168.1.248/30 are available on interfaces S0/0 and S0/1, respectively.

Router R3 knows the networks 192.168.1.248/30 and 20.0.0.0/8 are available on interfaces S0/0 and F0/1, respectively.

After the booting process, routers share configured routes in the network through the broadcasts. These broadcasts are known as routing updates.

The following image shows this process.

network running rip routing protocol

Routers also receive broadcasts (routing updates) on their active interfaces. Routers compare their routing tables with routing updates to learn about new IP subnets.

Router R1 receives one broadcast from the router R2 and learns one new IP subnet 192.168.1.248/30.

Router R2 receives two broadcasts: one from the router R1 and another from the router R2. From these broadcasts, the router R2 learns two new IP subnets: 10.0.0.0/8 and 20.0.0.0/8.

Router R3 receives one broadcast from the router R2 and learns one new IP subnet 192.168.1.252/30.

Routers add newly learned IP subnets with their respective ports in routing tables.

The following image shows routers with their updated routing tables.

routing tables after routing update

After 30 seconds (default time interval between two routing updates) all routers broadcast their routing tables again with updated information.

  • R1 broadcast the IP subnets: 10.0.0.0/8, 192.168.1.248/30 and 192.168.1.252/30.
  • R2 broadcast the IP subnets: 10.0.0.0/8, 20.0.0.0/8, 192.168.1.248/30 and 192.168.1.252/30.
  • R3 broadcast the IP subnets: 20.0.0.0/8, 192.168.1.248/30 and 192.168.1.252/30.

Routers also learn from the received broadcasts.

  • R1 learns about the network 20.0.0.0/8 from R2’s broadcast.
  • R2 learns nothing new from R1’s and R2’s broadcasts.
  • R3 learns about the network 10.0.0.0/8 from R2’s broadcast.

The following image shows routing tables of all routers after these routing updates.

rip routing  convergence

After 30 seconds, routers broadcast new routing information again. But this time, all routers know all routes of the network, so they will update nothing. This stage is known as convergence. The convergence is a term that refers to the time taken by all routers in understanding the current topology of the network.

The RIP protocol broadcasts successive routing updates even after achieving the phase of convergence. This helps the router to detect and adapt to any new changes that occur after the convergence.

Selecting/calculating the best route

Distance-vector routing protocols use distance (accumulated metric value) and direction (vector) to find and select the single best route for each IP subnet of the network. When a router running a distance-vector routing protocol learns about network routes, it learns three important facts related to each route: the destination subnet, the distance (routing protocol metric), and the vector (link and next-hop router to use as part of that route).

RIP uses distance to select the best route for each destination subnet. Distance is calculated in the term of hops. Each instance where a packet goes through a router is called a hop, and the route with the least number of hops to the destination subnet is selected as the best route for that destination subnet. The term vector indicates the direction to the destination subnet. RIP uses the interface of the next-hop router as the vector.

Let's understand this concept through an example.

The following figure shows an example of a network running the RIP routing protocol.

example of distance vector routing

In this network, the router A has three routes to the destination network. These routes are the following.

  1. The four-hops route (distance) through router B (vector)
  2. The one-hop route (distance) through router F (vector)
  3. The two-hops route (distance) through router G (vector)

Since the second route has the lowest hop count, router A uses this route to forward all packets of the destination network.

Key points: -
  • Distance-vector protocols do not perform any mechanism to know who their neighbors are.
  • Distance-vector protocols learn about their neighbors by receiving their broadcasts.
  • Distance-vector protocols do not perform any formal handshake or hello process with neighbors before broadcasting routing information.
  • Distance-vector protocols do not verify whether neighbors received routing updates or not.
  • Distance-vector protocols assume that if a neighbor misses an update, it will learn about the change in the next broadcast update.
  • RIP is a distance-vector routing protocol.
  • RIP routing protocol uses local broadcasts to share routing information.
  • RIP broadcasts routing updates every 30 seconds, regardless something in the network has changed or not. Once 30 seconds expires, routers running RIP protocol will broadcast their routing information to any devices connected to their interfaces.
  • Before sending routing updates, a router adds an initiating metric to every route which it has and increments the metric of incoming routes in advertisements so the listing routers can learn how far destination network is located.
  • When sending a broadcast, RIP does not care who will listen to this broadcast and who will not.
  • After sending the broadcast, RIP does not care whether neighbors received this broadcast or not.
  • When a router receives routing updates, it compares them with the routes that it already has in its routing table.
  • If the update has information about a route that is not available in its routing table, the router will consider that route as a new route.
  • The router will add all new routes in the routing table before updating existing routes.
  • If the update has better information for any existing route, the router will replace the old entry with new route information.
  • If the update has worse information for any existing route, the router will ignore it.
  • If the update has the same information about any existing route, the router will reset the timer for that route in the entry.

That's all for this part. In the next part of this tutorial, we will understand various timers and options that RIP uses to manage routing information. If you like this tutorial, please don't forget to share it with friends through your favorite social network.

ComputerNetworkingNotes CCNA Study Guide RIP - Routing Information Protocol Explained