Quick Summary
- A routing loop occurs when two or more routers keep forwarding a packet back and forth to each other
- TTL (Time to Live) prevents infinite loops by decrementing at each hop -- when it reaches 0, the packet is dropped
- Loop prevention mechanisms like split horizon, route poisoning, and hold-down timers stop loops before they start
What is a Routing Loop?
A routing loop happens when routers have conflicting or incorrect information in their routing tables, causing a packet to be forwarded in a circle. Router A thinks the best path to the destination is through Router B. Router B thinks the best path is back through Router A. The packet bounces between them endlessly, never reaching its destination.
This is not just a theoretical problem -- routing loops happen in production networks regularly, especially during convergence periods when routing protocols are recalculating paths after a topology change. A link goes down, routes are withdrawn, and for a brief window, routers may disagree about the best path. During that window, packets can get caught in a loop.
Without a safety mechanism, a looping packet would consume bandwidth forever, and every new packet to that destination would join the loop. The network would quickly saturate and collapse. This is why the TTL field exists in every IP packet. It is not a time limit in seconds -- it is a hop counter. Every router that forwards the packet decrements the TTL by one. When TTL reaches zero, the router drops the packet and sends an ICMP "Time Exceeded" message back to the source. The default TTL is 64 on Linux, 128 on Windows, and 255 on most routers.
Interactive: Watch a Routing Loop
Click "Start Loop" to watch a packet bounce between two misconfigured routers. Watch the TTL count down. Then click "Fix: Remove Loop" to see correct routing.
Why Routing Loops Form
Routing loops are almost always a convergence problem. When the network topology changes -- a link fails, a router reboots, or a new route is advertised -- routing protocols need time to propagate the updated information to all routers. During this convergence window, different routers have different views of the network. Router A may still think the old path through Router B works, while Router B already knows it does not and is trying to route through Router A as a fallback.
Distance-vector protocols like RIP are especially prone to routing loops because routers only know about the next hop, not the full path. This limited view makes it easy for incorrect information to propagate. The classic example is the count-to-infinity problem: when a destination becomes unreachable, routers keep advertising increasingly worse routes to each other, slowly incrementing the metric until it reaches the maximum (infinity). During this slow convergence, packets loop between the confused routers.
How TTL Saves the Network
The Time to Live (TTL) field in the IP header is the network's circuit breaker. Every IP packet starts with a TTL value set by the sender (commonly 64 or 128). Each router that forwards the packet decrements the TTL by one. When the TTL reaches zero, the router discards the packet and sends an ICMP Type 11 "Time Exceeded" message back to the sender. This prevents any single packet from circulating forever.
TTL is also the mechanism that makes traceroute work. Traceroute sends packets with incrementally
increasing TTL values (1, 2, 3, ...). The first packet expires at the first router, the second at the second router,
and so on. Each router's "Time Exceeded" response reveals its IP address, building a map of the path. If you see
the same IP addresses repeating in a traceroute output, that is a strong sign of a routing loop.
Loop Prevention Mechanisms
Split Horizon
A router never advertises a route back to the neighbor it learned it from. If Router A learned about network 10.0.3.0/24 from Router B, it will not tell Router B "I can reach 10.0.3.0/24 through you." This prevents the most basic two-node loop. Split horizon is a standard feature of RIP and EIGRP.
Route Poisoning
When a route becomes unreachable, the router immediately advertises it with an infinite metric (e.g., 16 in RIP) instead of simply withdrawing it. This explicitly tells all neighbors "this destination is unreachable" rather than leaving them to figure it out through timeout, which could cause temporary loops.
Hold-Down Timers
After a route is marked as unreachable, the router ignores any new advertisements for that route for a fixed period (the hold-down timer). This prevents a router from accepting stale information from a neighbor that has not yet heard about the topology change. The trade-off is slower convergence in exchange for loop prevention.
Path-Vector / Link-State Protocols
Modern routing protocols like BGP (path-vector) and OSPF/IS-IS (link-state) are inherently loop-free by design. BGP includes the full AS path in every route advertisement -- if a router sees its own AS number in the path, it rejects the route. OSPF and IS-IS give every router a complete map of the network topology, so they can independently calculate loop-free shortest paths using Dijkstra's algorithm.
Real-World Routing Loop Scenarios
Link Failure During Convergence
A fiber cut takes down the primary path. OSPF recalculates in 100ms, but the backup path's router still has the old route cached. For a brief moment, packets loop between the primary and backup routers until OSPF fully converges.
Static Route Misconfiguration
An admin configures Router A with a static route pointing to Router B for 10.0.3.0/24, and Router B has a default route pointing back to Router A. Any traffic to 10.0.3.0/24 loops forever. Static routes bypass protocol-based loop prevention, making manual errors dangerous.
Redistribution Loops
When routes are redistributed between two different routing protocols (e.g., OSPF into EIGRP and back), the same route can re-enter the original protocol with a different metric, creating a feedback loop. Route tags and filters are essential when doing mutual redistribution.
Detecting and Fixing Routing Loops
The first sign of a routing loop is usually packet loss to a specific destination, combined with high CPU or bandwidth
usage on the routers involved. Running traceroute to the affected destination will show the same router
IP addresses repeating in the output. On Cisco routers, show ip route reveals the next-hop for each
destination, making it easy to trace the loop manually.
To fix a routing loop, you need to correct the routing table entries that form the cycle. For static routes, verify that each router's next-hop ultimately leads toward the destination, not back in a circle. For dynamic routing protocols, check that convergence has completed, verify neighbor adjacencies, and ensure loop prevention features (split horizon, route filters) are enabled. If the loop is caused by redistribution, add route tags or prefix lists to prevent routes from being re-imported into the protocol they originated from.
Common Routing Loop Mistakes
Disabling Split Horizon
Some guides suggest disabling split horizon on hub-and-spoke topologies. While sometimes necessary, doing so without understanding the implications can re-introduce routing loops that the feature was designed to prevent.
Overlapping Static and Dynamic Routes
Having both a static route and a dynamic route to the same destination with similar metrics. If the dynamic route withdraws and the static route takes over pointing to a router that uses the dynamic route, you get a loop.
Missing Default Route Guard
A router with a default route (0.0.0.0/0) pointing to a neighbor that also has a default route pointing back. Any traffic to an unknown destination loops between them. Always ensure default routes form a clear hierarchy toward the internet gateway.
Frequently asked questions about routing loops
What is a routing loop?
A routing loop is a condition where two or more routers keep forwarding the same packet back and forth because their routing tables disagree about the next hop. The packet never reaches its destination — it bounces in a cycle until its TTL expires.
How does TTL prevent infinite routing loops?
Every IP packet carries a Time-to-Live field that each router decrements by one when forwarding. When TTL reaches zero the packet is dropped and the router sends an ICMP Time Exceeded message back to the source. No packet can circulate forever, even in a misconfigured topology.
What causes routing loops?
Most loops appear during convergence after a link failure, when routers briefly disagree about the best path. They are also caused by misconfigured static routes pointing back at each other, mutual redistribution between protocols without route tags, and disabled split horizon on distance-vector networks.
How do I detect a routing loop?
Run traceroute to the affected destination — if you see the same router IPs repeating in the output, that is a loop. You may also notice unusual CPU and bandwidth on the routers involved, plus complete packet loss to that destination while other destinations work fine.
How are routing loops prevented?
Distance-vector protocols use split horizon, route poisoning, and hold-down timers. Link-state protocols like OSPF avoid loops by giving every router a full topology view and running Dijkstra locally, and BGP uses the AS_PATH attribute so a router rejects any route that already contains its own AS number.
Try the routing loop lab
You just learned how TTL saves a misconfigured network from meltdown. Now trace a packet around a real routing loop until its TTL runs out, then fix the underlying route and see traffic delivered.
Launch the routing loop lab →