PacketLab
BGP · Advanced BGP Features

Backdoor Routes

Prefer a direct IGP path to a specific destination while retaining external BGP as backup.

Two customer sites and a provider

R1 and R2 exchange loopbacks over their direct OSPF link. They also advertise those /32s to provider R3 through separate external sessions. With the default administrative distances in this command family, eBGP distance 20 beats OSPF 110 for the same /32.

Lab topologyPhysical links
.1 / .2.5 / .6.9 / .10R1AS 65001R2AS 65002R3AS 65003
Solid lines are physical links. Endpoint labels are the last octets of 192.0.2.x/30, first router then second router in the address table. Loopback0 is 10.255.0.N/32 on RN. Logical BGP peers are listed in the configurations.
LinkFirst endpointSecond endpoint
R1–R2GigabitEthernet1 192.0.2.1/30GigabitEthernet1 192.0.2.2/30
R1–R3GigabitEthernet2 192.0.2.5/30GigabitEthernet1 192.0.2.6/30
R2–R3GigabitEthernet2 192.0.2.9/30GigabitEthernet2 192.0.2.10/30
Complete baseline configurations

R1

hostname R1
ip cef
interface Loopback0
 ip address 10.255.0.1 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.1 255.255.255.252
 no shutdown
exit
interface GigabitEthernet2
 ip address 192.0.2.5 255.255.255.252
 no shutdown
exit
router ospf 1
 router-id 10.255.0.1
 network 10.255.0.1 0.0.0.0 area 0
 passive-interface Loopback0
 network 192.0.2.1 0.0.0.0 area 0
exit
router bgp 65001
 bgp router-id 10.255.0.1
 no bgp default ipv4-unicast
 neighbor 192.0.2.6 remote-as 65003
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.6 activate
  network 10.255.0.1 mask 255.255.255.255
 exit-address-family
end

R2

hostname R2
ip cef
interface Loopback0
 ip address 10.255.0.2 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.2 255.255.255.252
 no shutdown
exit
interface GigabitEthernet2
 ip address 192.0.2.9 255.255.255.252
 no shutdown
exit
router ospf 1
 router-id 10.255.0.2
 network 10.255.0.2 0.0.0.0 area 0
 passive-interface Loopback0
 network 192.0.2.2 0.0.0.0 area 0
exit
router bgp 65002
 bgp router-id 10.255.0.2
 no bgp default ipv4-unicast
 neighbor 192.0.2.10 remote-as 65003
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.10 activate
  network 10.255.0.2 mask 255.255.255.255
 exit-address-family
end

R3

hostname R3
ip cef
interface Loopback0
 ip address 10.255.0.3 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.6 255.255.255.252
 no shutdown
exit
interface GigabitEthernet2
 ip address 192.0.2.10 255.255.255.252
 no shutdown
exit
router bgp 65003
 bgp router-id 10.255.0.3
 no bgp default ipv4-unicast
 neighbor 192.0.2.5 remote-as 65001
 neighbor 192.0.2.9 remote-as 65002
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.5 activate
  neighbor 192.0.2.9 activate
 exit-address-family
end

Open plain-text configurations

Outputs are illustrative, not recorded router results. Each lab starts from its own baseline. Configuration and feature support vary by image and release; platform-specific examples identify their prerequisites.

Inspect the undesired exit

R1# show ip route 10.255.0.2
Routing entry for 10.255.0.2/32
  Known via "bgp 65001", distance 20, metric 0
  * 192.0.2.6, via GigabitEthernet2

The direct physical path may be faster, but route-source preference makes R1 use R3. Administrative distance is local and differs from BGP LOCAL_PREF.

Mark the remote destination backdoor

router bgp 65001
 address-family ipv4 unicast
  network 10.255.0.2 mask 255.255.255.255 backdoor
 exit-address-family

R2

router bgp 65002
 address-family ipv4 unicast
  network 10.255.0.1 mask 255.255.255.255 backdoor
 exit-address-family

The backdoor statement changes treatment of the specified BGP destination to the local/internal distance, normally 200. It does not originate that remote prefix as an ordinary network statement would.

Verify primary and fallback routes

R1# show ip route 10.255.0.2
Routing entry for 10.255.0.2/32
  Known via "ospf 1", distance 110, metric 2
  * 192.0.2.2, via GigabitEthernet1

The IGP copy now wins installation. In the lab, shut the direct R1–R2 interface and wait for OSPF to withdraw; the external BGP candidate can then become the fallback.

interface GigabitEthernet1
 shutdown
exit
R1# show ip route 10.255.0.2
Routing entry for 10.255.0.2/32
  Known via "bgp 65001", distance 200, metric 0
  * 192.0.2.6, via GigabitEthernet2

Restore the direct link and baseline

interface GigabitEthernet1
 no shutdown
exit
router bgp 65001
 address-family ipv4 unicast
  no network 10.255.0.2 mask 255.255.255.255 backdoor
 exit-address-family

R2

router bgp 65002
 address-family ipv4 unicast
  no network 10.255.0.1 mask 255.255.255.255 backdoor
 exit-address-family

The saved baseline again prefers eBGP distance 20. Keep the backdoor setting instead when it is the intended operational policy. Always compare identical prefix lengths before comparing route-source preference.

Key Takeaways

  • Backdoor changes local installation preference for a specified destination.
  • Default eBGP distance 20 beats OSPF 110 in these examples.
  • A backdoor destination normally uses distance 200.
  • The statement does not originate the remote destination.
  • An existing external path can remain as fallback.

Backdoor Routes Quiz

Six questions · four options each · select one answer per question. Submit all answers to see your score and explanations.

1. Why does R1 initially choose the provider?
2. What is the usual backdoor distance here?
3. Does the backdoor statement originate the remote prefix?
4. After direct OSPF failure, what can provide fallback?
5. Is administrative distance transmitted as LOCAL_PREF?
6. Must prefix lengths be identical for this comparison?
Protocol and command references

Backdoor command reference · BGP specification · Router-symbol attribution.