From point A to point B
Point A: your BGP network works, but a failure between two routers can leave you sending traffic nowhere for three minutes, and when BGP picks a route you can't explain why. Point B: you detect the failure in milliseconds with BFD, you take a prefix out of BGP with a backdoor when an IGP has a better path, and you walk through the best path algorithm step by step.
- Why an indirect link leaves BGP waiting for the 180-second hold time.
- BFD with
bfd interval 50 min_rx 50 multiplier 3andneighbor … fall-over bfd. - BGP backdoor with EIGRP 100: administrative distances 20, 90 and 200, and RIB-failure.
- The best path algorithm with the N WLLA OMNI rule and its tie-breakers.
- Why BGP doesn't load-balance by default and what
maximum-pathsdoes.
Ticket 7: the indirect link
Ticket 7 says: “R3 must converge in 50 ms with R4 in case of an indirect link failure.”
Picture R4 in Panama and R3 in a lab in the United States. There is no fiber running from one rack to the other. In between there are switches, transport and provider equipment. Between two BGP routers there is always an indirect link.
If the fiber fails inside Panama, the nearest switch is the one that notices. R3's interface stays up, because its side of the cable didn't change. For R3, the neighbor is still there.
180 seconds of waiting
When does BGP find out? When the hold time expires. On Cisco the keepalive is 60 seconds and the hold time is 180. If no KEEPALIVE or UPDATE arrives within 180 seconds, the router declares the neighbor dead and closes the session with a NOTIFICATION.
! default timers: keepalive 60 s, hold time 180 s
R3# show ip bgp summary
R3# show ip bgp neighbor
! R4 shuts its interface toward R3
R4(config)# interface GigabitEthernet0/0
R4(config-if)# shutdown
R4# show ip bgp summary
! R3 still shows the session up until the hold time expires
R3# show ip bgp summary
R3# show ip bgp
In the demo, Jesús shuts R4's interface toward R3. R4 goes to Idle instantly: for R4 the failure is direct. R3, on the other hand, doesn't flinch. The session stays Established, the counter keeps going up, and 40.40.40.0 is still best through 172.16.4.4. Wireshark shows TCP retransmissions and, at the end, the NOTIFICATION with hold time expired.
Why does it matter? R4 no longer sends traffic over that link, but R3 does. If other AS use R3 to reach 40.40.40.0, that traffic is lost for three minutes. Today 30 seconds is already a significant outage; three minutes is a lot of money lost.
BFD: failure in milliseconds
Bidirectional Forwarding Detection (BFD, RFC 5880) is a failure-detection protocol. It works at the interface level, sends control packets very fast and is independent of the routing protocol: once configured, you tie it to OSPF, EIGRP or BGP. BGP hands detection over to it and no longer depends on its 180 seconds.
! R4: BFD on the interface toward R3, then BGP uses it
R4(config)# interface GigabitEthernet0/0
R4(config-if)# bfd interval 50 min_rx 50 multiplier 3
R4(config-if)# exit
R4(config)# router bgp 64100
R4(config-router)# neighbor 172.16.4.3 fall-over bfd
! R3: the same on the other end
R3(config)# interface GigabitEthernet0/1
R3(config-if)# bfd interval 50 min_rx 50 multiplier 3
R3(config-if)# exit
R3(config)# router bgp 1.1
R3(config-router)# neighbor 172.16.4.4 fall-over bfd
R3# show bfd summary
R3# show bfd neighbors
bfd interval 50 min_rx 50 multiplier 3 means: I send every 50 ms, I expect to receive every 50 ms, and if three packets in a row are lost, I declare the neighbor down. With these values, detection takes about 150 ms.
A detail you see in the class: with BFD only on the interfaces, show bfd neighbors shows nothing. The BFD session appears when a protocol asks for it. As soon as R4 has neighbor 172.16.4.3 fall-over bfd, Wireshark shows the BFD control messages: first the Init state and then Up, with one packet every 50 ms. Then R3 does the same toward 172.16.4.4.
R4(config)# interface GigabitEthernet0/0
R4(config-if)# shutdown
! R3 drops the session in milliseconds
R3# show ip bgp summary
R3# show ip bgp
R3# traceroute 40.40.40.40 source 30.30.30.30 ttl 1 5
The test is repeated: shutdown on R4's interface. This time the BFD session goes down and takes BGP with it. On R3, show ip bgp summary shows the neighbor in Idle immediately, show ip bgp has 40.40.40.0 through 172.16.2.1, and the traceroute from 30.30.30.30 goes down through R1 and R2 to R4. In milliseconds, with no intervention.
fall-over bfd on its BGP neighbor. Verify with show bfd summary and show bfd neighbors.Ticket 12: one hop for VIP customers
Ticket 12 says: “R3 must be able to use the 172.16.7.0 segment with EIGRP to reach the 60.60.60.60 prefix.” The story: the company bought a 100 Gb link that connects R6 directly to R3. The 60.60.60.0 network belongs to VIP customers and must use that link, on one condition: the solution must stay outside BGP.
The starting point is bad. The traceroute from R3 (source 30.30.30.30) to 60.60.60.60 goes through R1, R2, R4 and R5 before reaching R6. Five hops when the direct cable gives one.
R3# traceroute 60.60.60.60 source 30.30.30.30 ttl 1 5
R3(config)# router eigrp 100
R3(config-router)# network 172.16.7.0 0.0.0.255
R3# show ip eigrp neighbors
R3# ping 172.16.7.6
R3# show ip route
R3# show ip eigrp topology
First, EIGRP 100 is enabled on the 172.16.7.0/24 segment. R6 already had it configured and advertises 60.60.60.0. The adjacency comes up and the ping to 172.16.7.6 answers. But show ip route still shows 60.60.60.0 as a BGP route. Why?
Because when the same prefix arrives through two protocols, with the same length, the routing table breaks the tie with the administrative distance. It's basic CCNA routing: the lowest value wins. And eBGP (20) beats EIGRP (90).
network backdoor and administrative distance
| Route source | Administrative distance |
|---|---|
| Connected · static | 0 · 1 |
| eBGP | 20 |
| Internal EIGRP | 90 |
| OSPF | 110 |
| iBGP · local BGP · backdoor | 200 |
The network … backdoor command marks a prefix learned through eBGP as a “back door” route. BGP gives it distance 200, like a local route, and the IGP wins. Jesús describes it as a script that tells the route: “you used to be worth 20; now you're worth 200.”
R3(config)# router bgp 1.1
R3(config-router)# network 60.60.60.0 mask 255.255.255.0 backdoor
! 60.60.60.0/24 now comes from EIGRP (90); BGP shows it as RIB-failure (r)
R3# show ip route
R3# show ip bgp
R3# traceroute 60.60.60.60 source 30.30.30.30 ttl 1 5
You read the result in three places:
show ip route: 60.60.60.0 is now an EIGRP D route, distance 90, through 172.16.7.6.show ip bgp: the route is still in BGP, but marked r, RIB-failure. BGP has it, but another protocol installed it in the routing table.- The traceroute reaches 60.60.60.60 in a single hop.
Before the backdoor, R3 installs the eBGP route (distance 20) and traffic takes five hops. With network 60.60.60.0 mask 255.255.255.0 backdoor, the eBGP route goes to 200 and EIGRP (90) wins over the direct link. Diagram: The House of Routing.
According to Cisco's command reference, a backdoor network is treated as local but is not advertised, and the best path algorithm doesn't change. The backdoor only acts on the distance, which lives in the routing table. That's why Jesús solved this ticket before the theory: to make it clear that administrative distance doesn't appear in BGP. And remember that the backdoor only affects that prefix on that router: return traffic toward 30.30.30.0 needs its own backdoor on R6.
The best path with N WLLA OMNI
When BGP has several paths to the same prefix, it picks one. Jesús uses a mnemonic he learned years ago: N WLLA OMNI. Each letter is a step, in order.
The best path ladder: BGP compares step by step and stops at the first one that breaks the tie. Diagram: The House of Routing.
- N, valid next hop. More a requirement than a step. It isn't enough for the attribute to carry a next hop: the router must reach it through recursion. Otherwise the route doesn't even enter the algorithm.
- W, weight. Higher is better. It's Cisco-specific and local to the router: it isn't advertised to anyone.
- L, local preference. Higher is better. Default 100; in the previous chapter you raised it to 500.
- L, locally originated. The route the router itself originated with
network,redistributeoraggregate-addressis preferred. - A, AS_PATH. Shorter is better. Since weight and local preference are rarely touched, in practice this is usually the attribute that decides. That's why prepend works.
The rule to remember: in W and L the highest value wins; from A down, the lowest or shortest wins.
Origin, MED, neighbor type and tie-breakers
- O, origin. IGP (i) is better than EGP (e), and EGP is better than incomplete (?). The i comes from the
networkcommand; the ? usually comes from redistribution. EGP is the protocol that existed before BGP: you won't see it. That's why the class recommends advertising withnetwork. - M, MED (multi-exit discriminator). Lower is better. It's rarely used, and by default it's only compared between routes from the same neighboring AS.
- N, neighbor type. eBGP is preferred over iBGP. This has nothing to do with administrative distance (20 or 200), which lives in the routing table. In
show ip bgpyou see it in the “i” on the left, the one for internal routes. - I, IGP metric to the next hop. Lower is better: the closest next hop according to the IGP.
If everything is still equal, Cisco's official order ends with the tie-breakers:
| Step | Preferred |
|---|---|
| Multipath | If maximum-paths allows it, several routes are installed in the table |
| Oldest eBGP | Between two external routes, the one received first (avoids flapping) |
| Router ID | The lowest router ID (with a route reflector, the originator ID) |
| Cluster list | The shortest cluster list (route reflector only) |
| Neighbor address | The lowest neighbor IP |
In the class, Jesús names these tie-breakers and wonders whether the route reflector one goes among them. Cisco's documentation places it right before the last one: router ID, then the cluster list and finally the neighbor IP.
Why BGP doesn't load-balance
If everything ends up tied, does BGP share the traffic? Not by default. The BGP multipath value is 1: a single route in the routing table.
Equal-cost load balancing needs three things:
- The routes must tie on weight, local preference, AS_PATH length, origin, MED and IGP metric to the next hop.
- They must come from the same neighboring AS, for example over two circuits to the same provider.
- You must configure
maximum-pathswith a value greater than 1 in the BGP process (for iBGP,maximum-paths ibgp).
Multipath doesn't change the best path: the router still picks one best route, and it's the only one it advertises to its neighbors. And if you want to “load-balance across different autonomous systems”, Jesús is clear: that doesn't exist by default. Work with your attributes: local preference for what leaves, prepend or MED for what comes in.
With these tickets the 2nd Marathon closes 8 of 12: 1 through 7, and 12. Summarization and communities (tickets 8 to 11) are left for the Day 3 ticket workshop.
Class videos
These are the two parts of the 2nd BGP Marathon that go with this chapter. Jesús recorded them live on March 6, 2021, with Cisco IOSv routers in GNS3. The audio is in Spanish, with subtitles in Spanish, English, French and Portuguese.
- Day 2 · Part 6AS_PATH prepend, local preference, BFD and BGP backdoorWatch video
- Day 2 · Part 7BGP backdoor, the N WLLA OMNI rule and the close of the 2nd marathonWatch video
Recorded live; Spanish audio with Spanish, English, French and Portuguese subtitles. When you play it, the video loads from YouTube. Day 2 playlist on YouTube
Test what you learned
1. The fiber between R3 and R4 fails, but R3's interface stays up. Without BFD, how long does R3 take to close the session with Cisco's default values?
Answer. Up to 180 seconds, the hold time. Only then does it send a NOTIFICATION for hold time expired and withdraw that neighbor's routes.
2. You configure bfd interval 50 min_rx 50 multiplier 3 on both interfaces, but show bfd neighbors is still empty. What's missing?
Answer. A client protocol that uses BFD. In BGP it's neighbor … fall-over bfd on both routers. Then the BFD session goes from Init to Up.
3. R3 learns 60.60.60.0 through eBGP and through EIGRP. Which one goes into the routing table, and what changes with network 60.60.60.0 mask 255.255.255.0 backdoor?
Answer. Without backdoor, the eBGP route is installed (20 versus 90). With backdoor, the eBGP route goes to 200 and the EIGRP route is installed. In BGP the route shows as RIB-failure.
4. Two routes to the same prefix have the same weight and the same local preference, neither is local, and one has a shorter AS_PATH. Which one wins?
Answer. The one with the shorter AS_PATH. It's step A of N WLLA OMNI and, in practice, the one that decides most often.
5. R4 receives the same prefix from two different autonomous systems, tied on everything. Does BGP load-balance?
Answer. No. By default multipath is 1, and even with maximum-paths the routes must come from the same neighboring AS. It picks one through the tie-breakers.
Key takeaways
- There is always an indirect link between BGP routers; without help, BGP waits for the 180-second hold time.
- BFD detects the failure in milliseconds:
bfd intervalon the interface andneighbor … fall-over bfdin BGP, on both ends. - Administrative distance lives in the routing table: eBGP 20, EIGRP 90, OSPF 110, iBGP 200.
network … backdoorraises the eBGP route to 200 so the IGP wins; BGP marks it as RIB-failure.- N WLLA OMNI: valid next hop, weight, local preference, locally originated, AS_PATH, origin, MED, neighbor type and IGP metric to the next hop.
- Then come multipath, oldest eBGP, router ID, cluster list and neighbor IP.
- BGP doesn't load-balance by default: it needs a tie, the same neighboring AS and
maximum-paths.
Official resources
- Select BGP Best-path Algorithm (Cisco)cisco.com
- BFD Configuration Guide: Bidirectional Forwarding Detection (Cisco IOS XE)cisco.com
- Cisco IOS IP Routing: BGP Command Reference, M through N (network backdoor, maximum-paths)cisco.com
- Understand Administrative Distance (Cisco)cisco.com
- BGP Configuration Guide: Configuring a Basic BGP Network (Cisco IOS XE)cisco.com
- RFC 5880: Bidirectional Forwarding Detection (BFD)rfc-editor.org
- RFC 4271: A Border Gateway Protocol 4 (BGP-4)rfc-editor.org
Source and credits. Chapter written from the BGP Masterclass that Jesús Espinoza recorded live in 2021. Text drafted with AI assistance and reviewed; original diagrams by The House of Routing. Technical details and configuration were checked against official Cisco documentation and IETF RFCs.