Formation of a Routing Loop

The simplest form of routing loop is indicated by figure-1.

 

 

FIGURE-1: Basic Form of Routing Loop

R1 needs to transmit data to R3. The best path is via R2 (metric=3). For some reason, the link between R2 and R3 goes down and R2 has not yet informed R1. But R2 also knows of another path to R3 through R1. Therefore, R2 will send the traffic back to R1. Now R1 is forwarding traffic originated from R1 plus traffic coming back from R2. A (infinite) routing loop has now occurred and traffic just forwarded back and forth between R1 and R2 unless some mechanism exits to prevent this behavior.

Types of Routing Loops

There are two types:

1- Transient Loops

Transient loops occur as part of the normal operation of the routing protocol due to different delays in routing information propagation. Once the protocol converges, the loop disappears. In figure-1, if split horizon and triggered updates are implemented, this loop will be avoided.

2- Persistent Loops

In figure-1, what happens if router R3 fails? R1 thinks R3 is reachable via R2 (due to lower metric). R2 know that R3 is down, but it can reach it through R1. R1 will install the route to R3 via R1 with a metric of 12. The analogy is simple: some (bad) information is better than no information. Again traffic goes back and forth between R1 and R2 and the loop goes on indefinite. A good example is RIP; the loop persists until the metric reaches infinity (hop count=16), the packet will be discarded.

Persistent loops usually occur due to mis-configuration and require human intervention. They are also difficult to troubleshoot. A classical example is of route redistribution. In figure-2, R5 advertises 192.168.5.0/24 to R2 and R4 with a hop count of 5. OSPF and RIP are mutually redistributed at R2 and R4. The redistribution seed metric for RIP is 1.

 

FIGURE-2: Route Redistribution and Routing Loop

 

Let us consider the case when redistribution is performed at R4 only. R4 redistributes routes from RIP into OSPF. These routes propagated all the way OSPF domain and reaches R2. R2 now has two routes to 192.168.5.0/24. Through R1 with an (OSPF) AD=110 and (RIP) AD=120. Since Administrative Distance (AD) is the trustworthiness of a routing protocol, R2 will now prefer to reach network 192.168.5.0/24 through OSPF domain (path: R2àR1àR3àR4àR5). We have a sub-optimal path to R5’s 192.168.5.0/24 network.

Now R2 is also configured to for mutual redistribution between RIP and OSPF (there are now two points of redistribution one at R2 and the other at R4).  Since RIP redistributes only those routes that are in IP routing table, therefore 192.168.5.0/24 will be redistributed from OSPF to RIP (with a metric=1) and advertise to R4 and R5. Now R5 and R4 point to R2 to reach destination 192.168.5.0/24 and a routing loop has occurred. If a packet arrives at R4 for destination 192.168.5.0/24, it will be forwarded to R2 to R1 to R3 to R4 to R1 and so forth.

To remedy this problem, R2 and R4 should be configured such that they always prefer (internal) RIP routes over any (external) redistributed routes learned from R2 or R4.

On Router R2 and R4:

(config)# router ospf 1

(config-router)# distance ospf external 121

Today we covered routing loops, how they are formed and the types of routing loops. This lesson should have given us a fair idea of what conditions trigger a routing loop and how to prevent it.