This tutorial explains routing loops in detail through examples. Learn what the routing loops are and how they are formed in a distance-vector routing protocol running network.
Distance-vector routing protocols use broadcast messages to learn and advertise network paths.
A router running a distance-vector routing protocol periodically sends broadcast messages out from all of its active interfaces. These broadcast messages include the complete routing table of the router.
When other routers running the same distance-vector routing protocol receive these broadcast messages, they learn new routes from the advertised routing table and add them to their routing table.
Through this process, all routers running the same distance-vector routing protocol learn all routes of the network.
Like any other type of routing protocol, distance-vector routing protocols also have some problems. Routing loops are the most common problem of distance-vector routing protocols.
What is a routing loop?
A routing loop is a confusion about the reachability of a destination network. Routing loops not only consume a lot of precious network bandwidth but also cause the router to believe that an inaccessible network is accessible.
What causes a routing loop?
Distance-vector routing protocols use the routing update timer to propagate routing updates. If the value of this timer is not the same on all routers, routing loops may occur. In other words, routing loops may occur when all routers do not broadcast routing updates simultaneously.
When a loop occurs, a router (call it A) thinks that the path to some destination (call it B) is available through its neighboring router (call it C), at the same time the neighboring router (B) thinks that the path to the same destination (C) is available through the first router (A). When a packet for the destination C arrives, it will loop endlessly between routers: A and B.
Let's understand this example in detail.
Routing loops example
The following figure illustrates a simple network. In this network, a destination network 1.0.0.0/8 is directly connected to router C on its F0/0 interface. To ensure that the destination network 1.0.0.0/8 always remains available, the administrator added an additional link between routers: A and B.
To enable IP routing, the administrator configured the RIP routing protocol. RIP is a distance-vector routing protocol and uses broadcast messages to learn and advertise network paths. RIP broadcasts routing updates every 30 seconds.
Now, suppose this network is powered off. To start this network, the administrator powered on all routers in the following order: C, A, and B. Since all routers are started at different times, their routing update timers are also running differently.
When the router C starts, it sends a broadcast message out from all of its active interfaces. This message indicates that the network 1.0.0.0/8 is reachable through router C at the cost of one hop.
To learn how the RIP routing protocol works in detail through examples, you can check the previous parts of this article.
This tutorial is the fourth part of the article "How to configure RIP routing protocol explained with features and functions of the RIP protocol". The previous parts of this article are the following.
How RIP routing protocol works
This tutorial is the first part of the article. This part explains how the RIP routing protocol uses broadcast messages to exchange network paths' information.
RIP Routing Information Protocol Explained
This tutorial is the second part of the article. This part explains the concept of distance-vector routing and how the RIP routing protocol uses this concept.
Basic operation of RIP protocol
This tutorial is the third part of the article. This part explains RIP timers and differences between RIPv1 and RIPv2.
Both routers: A and B receive broadcast messages from router C on their interfaces: S0/0/0 and S0/0/0, respectively.
When a router receives a routing update, it learns the advertised routes and does the following.
- If the advertised route is not available in the routing table, the router adds the advertised route to the routing table.
- If the advertised route is available in the routing table, the router compares the metric of the advertised route with the metric of the route that is available in the routing table.
- If the metric of the advertised route is worse, then the router ignores the advertised route and keeps the existing route.
- If the metric of the advertised route is better, then the router replaces the existing route with the advertised route.
- If the metric of the advertised route is equal, then the router adds the advertised route to the routing table along with the existing route. This feature is known as load balancing.
From the received routing update, both routers: A and B learn that the destination network 1.0.0.0/8 is available through router C at a cost of 1 hop. Since the routing tables of both routers are empty, they both add this routing information to their routing tables.
The following image shows this process.
After router C, router A broadcasts its routing update. This routing update indicates that the network 1.0.0.0/8 is reachable through router A at the cost of 2 hops. Both router B and C receive this update. But they do not add the advertised route in their routing tables, as they already have a better route for the destination.
The following image shows this process.
In the end, router B broadcasts its routing update. This routing update indicates that the network 1.0.0.0/8 is reachable through router B at the cost of 2 hops. Both routers A and C receive this message and ignore it, as they already have a better route for the destination network.
The following image shows this process.
At this moment all routers have learned all routes of the network. This state of the network is called convergence. Routers do not stop broadcasting routing updates after getting the state of convergence. As long as the network is running, all routers continuously broadcast their routing tables when their periodic timer expires. This feature helps routers to learn any network change that occurs in the future.
Physical loops V/s Routing loops
Usually, physical loops do not cause much trouble for routing protocols. For example, our network works fine even it includes a physical loop.
To eliminate any possibility of forming routing loops due to the physical loops of the network, distance-vector routing protocols add only one best route for each destination in the routing table.
But, this feature does not prevent routing loops that are caused by differences between routing update timers. Let's understand it.
Suppose, the connection between router C and the destination network's switch fails.
Since the destination network is directly connected to router C, router C immediately detects this change and removes the entry that is associated with the destination network from the routing table. However, router C does not pass this information to routers: A and B until its routing update timer expires.
The following image shows this process.
Now suppose that the routing update timer of router A expires before the routing update timer of router C expires.
Router A broadcast its routing update. This routing update indicates that the network 1.0.0.0/8 is reachable thorough the router A at the cost of 2 hops. Both routers: B and C receive this message.
Router B ignores this update message as it still has a better route for the destination. But, router C not only processes this message but also adds the advertised route to its routing table as currently its routing table has no route for the destination network.
The following image shows this process.
When the routing update timer of router C expires, the router C broadcasts its routing update. This routing update indicates that the destination network 1.0.0.0/8 is reachable through router C at the cost of 3 hops.
Both routers A and B receive this message and ignore it as they both have a better route for the destination.
The following image shows this process.
When the routing update timer of router B expires, the router B broadcasts its routing update. This routing update indicates that the network 1.0.0.0/8 is reachable through router B at the cost of 2 hops.
Both routers: A and C receive this message. Router A ignores this message as it already has a better route for the destination network. Router C adds the advertised route to its routing table because the advertised route and the existing route both have equal cost. Routers add equal-cost routes for load balancing.
The following figure shows this process.
At this moment, the network is converged again. But, this convergence is false. The destination network is down but routers A and B think that the router C knows how to reach the destination network while the router C thinks that the routers A and B equally know how to reach the destination network. This misunderstanding creates a routing loop.
When routers A and B receive a packet for the destination network 1.0.0.0/8, they will forward that packet to router C. And the router C will forward that packet back router A. The packet will keep cycling between routers: A and C endlessly.
The following image shows how a packet received by router B gets stuck in a routing loop.
This is a very simple example of a routing loop. Typically, routing loops are created because of confusion in the network related to the drawbacks of using periodic timers.
That's all for this part. The next part of this article covers the methods that a distance-vector protocol might implement to solve routing loop problems. If you like this tutorial, please don't forget to share it with friends through your favorite social network.