This topic is about BGP’s ability to prefer another router (kinda de-prefer, actually). The following diagram will make it clear.

In this situation, it may be a better choice to traverse from R1 to R2 via the point-to-point link instead of going over the ISP Cloud. Here R1 and R2 are eBGP peers only. The P2P link is peered over OSPF. But, since EBGP AD is 20 and OSPF 110. The route via ISP will be preferred for Lo5 network to reach Lo15 network segment.
Configuration
!--R1
R1#sh ip int brief | ex un
Interface IP-Address OK? Method Status Protocol
FastEthernet1/0 172.16.126.1 YES manual up up
Serial2/0 10.201.1.1 YES manual up up
Loopback5 172.16.5.1 YES manual up up
router ospf 100
log-adjacency-changes
redistribute bgp 100
network 172.16.5.0 0.0.0.255 area 0
network 172.16.126.0 0.0.0.255 area 0
router bgp 100
no synchronization
bgp log-neighbor-changes
network 10.201.1.0 mask 255.255.255.252
network 172.16.6.0 mask 255.255.255.0
network 172.16.16.0 mask 255.255.255.0 backdoor
neighbor 10.201.1.2 remote-as 200
no auto-summary
!--R2
R2#sh ip int brie | ex un
Interface IP-Address OK? Method Status Protocol
FastEthernet1/0 172.16.126.2 YES manual up up
Serial2/0 10.201.1.5 YES manual up up
Loopback15 172.16.15.1 YES manual up up
router ospf 100
log-adjacency-changes
redistribute bgp 300
network 172.16.15.0 0.0.0.255 area 0
network 172.16.126.0 0.0.0.255 area 0
router bgp 300
no synchronization
bgp log-neighbor-changes
network 10.201.1.4 mask 255.255.255.252
network 172.16.6.0 mask 255.255.255.0 backdoor
network 172.16.16.0 mask 255.255.255.0
neighbor 10.201.1.6 remote-as 200
no auto-summary
R2#sh ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 5 subnets
S 172.16.16.0 is directly connected, Null0
C 172.16.15.0 is directly connected, Loopback15
B 172.16.5.0 [20/0] via 10.201.1.6, 00:00:23
B 172.16.6.0 [200/0] via 10.201.1.6, 00:13:48
C 172.16.126.0 is directly connected, FastEthernet1/0
10.0.0.0/30 is subnetted, 2 subnets
B 10.201.1.0 [20/0] via 10.201.1.6, 00:25:59
C 10.201.1.4 is directly connected, Serial2/0
Conclusion
The above output shows the difference in AD of the 5.x and 6.x networks coming from R1. When 6.x network was announced as a BGP backdoor its AD was raised to 200.
Tags: BGP Cisco CLI Configuration Router Routing