Skip to content
Dorian FINKEL
BGPBFDWANLessons learned · 2026 · 7 min read · Updated 9 October 2026

Dual-carrier BGP: who decides the path?

With two links to two carriers, outbound and inbound traffic are not steered with the same lever. Local-preference on one side, AS-path prepending or communities on the other, filters so you never become a transit, and BFD so failover doesn’t wait three minutes.

01Two directions, two levers

On a site connected to two carriers, “which link is used?” has two answers: one for traffic going out, one for traffic coming back. The first is decided at home; the second is decided by others, whom you can only influence.

The lab reproduces this in EVE-NG: two edge routers, each peering eBGP with a simulated carrier, linked to each other with iBGP, in front of a core.

02iBGP between the two edges

A route learned over eBGP keeps the carrier’s address as next hop when it is passed on over iBGP. If the other edge router cannot reach that interconnect subnet, it considers the route unusable and ignores it. next-hop-self replaces that next hop with the announcing router’s own address, reachable through the internal IGP.

The iBGP session runs between loopback interfaces: it survives the loss of a physical link as long as another path exists.

Example · Cisco IOS
router bgp 65001
 neighbor 10.255.0.2 remote-as 65001
 neighbor 10.255.0.2 update-source Loopback0
 neighbor 10.255.0.2 next-hop-self

03Outbound: local-preference

Local-preference is internal to the AS: it travels between routers over iBGP, defaults to 100, and the highest value wins. It is compared very early in the decision process, before AS-path length. Raising it on routes learned from the primary carrier sends the whole site out through it while it is available.

A route-map with no match clause applies to every route received from that neighbour.

Example · Cisco IOS
route-map FROM-CARRIER-A permit 10
 set local-preference 200
!
router bgp 65001
 neighbor 203.0.113.1 remote-as 64500
 neighbor 203.0.113.1 route-map FROM-CARRIER-A in

04Inbound: AS-path prepending, and its limit

For return traffic you can only make a path less attractive. Repeating your own AS number in announcements sent to the backup carrier lengthens the AS path seen from the Internet: networks that compare both paths then prefer the primary carrier.

The limit is rarely explained: most carriers give their customers’ routes a higher local-preference than routes learned elsewhere. For the backup carrier itself, prepending therefore changes nothing: it never gets to compare AS-path lengths, and its own customers keep arriving over the backup link.

Example · Cisco IOS
route-map TO-CARRIER-B permit 10
 set as-path prepend 65001 65001 65001
!
router bgp 65001
 neighbor 198.51.100.1 remote-as 64510
 neighbor 198.51.100.1 route-map TO-CARRIER-B out

05Communities, the most reliable lever

The answer described in RFC 1998: the carrier publishes BGP community values with a fixed meaning, for example “lower the local-preference of this route inside my network”. The customer tags its announcements towards the backup link, and the carrier treats it as a last-resort path, without a support ticket.

Values are specific to each carrier: they are in its documentation or its PeeringDB record. The one below is an example.

Example · Cisco IOS
route-map TO-CARRIER-B permit 10
 set community 64510:90        ! example: "backup route" at carrier B
!
router bgp 65001
 neighbor 198.51.100.1 send-community

06Filter what you announce

A multihomed site must only announce its own prefixes. Without a filter it may re-announce routes learned from one carrier to the other and become a transit between them: the root cause of several famous route leaks. An outbound prefix-list on every eBGP neighbour settles it.

The network command only announces a prefix that exists exactly in the routing table; a static route to Null0 keeps it there permanently.

Example · Cisco IOS
ip route 192.0.2.0 255.255.255.0 Null0
ip prefix-list MY-PREFIXES seq 10 permit 192.0.2.0/24
!
router bgp 65001
 network 192.0.2.0 mask 255.255.255.0
 neighbor 203.0.113.1 prefix-list MY-PREFIXES out
 neighbor 198.51.100.1 prefix-list MY-PREFIXES out

07Detecting failure: BFD

On its own, BGP notices a lost neighbour when its hold time expires: 180 seconds by default on Cisco IOS (keepalives every 60 seconds). BFD exchanges very frequent messages and reports the failure in under a second; the BGP session drops immediately and failover starts.

With 300 ms and a multiplier of 3, a failure is detected in about 900 ms. BFD must be enabled on both sides: if the carrier does not offer it, reduced BGP timers (for example 10 and 30 seconds) are a compromise.

Example · Cisco IOS
interface GigabitEthernet0/0
 bfd interval 300 min_rx 300 multiplier 3
!
router bgp 65001
 neighbor 203.0.113.1 fall-over bfd

08Apply and verify without an outage

A modified policy does not apply to routes already received. A soft reset asks for or resends the announcements without tearing the session down. Then check what is actually announced to each neighbour, not just what you believe you configured.

Example · Cisco IOS
clear ip bgp 203.0.113.1 soft in
show ip bgp 0.0.0.0                                   ! chosen path, local-preference
show ip bgp neighbors 198.51.100.1 advertised-routes  ! only our prefixes?
show bfd neighbors

09Verify by breaking it

The behaviour is only validated by causing failures: cut one link, then the other, and record the path taken and the failover time. For inbound traffic you have to look from the outside: a carrier looking glass or a traceroute launched from the Internet shows which way traffic really comes back. That test grid became reusable for other WAN designs.

Key takeaways

  • Outbound: local-preference, decided at home.
  • Inbound: prepending or communities, an influence on others.
  • Prepending does not affect the backup carrier itself: communities do.
  • next-hop-self over iBGP, an outbound prefix-list on every eBGP neighbour.
  • BFD brings failure detection under one second.

Addresses and AS numbers reserved for documentation (RFC 5737, RFC 5398).

Official sources