EBGP Route Selection

Routes are selected based on the administrative distance of the routing protocol running on that route. Routing protocols with lower administrative distances are given priority over routing protocols with higher administrative distances. EBGP has an administrative distance of 20. OSPF has an administrative distance of 110.

This diagram shows three ASs and the routing protocols used by the BGP routers.

EBGP Route Selection Configuration

The RTC router in AS300 advertises route 1000::/64 to both AS100 and to AS200:

RTA (AS100) receives updates about route 1000::/64 from both OSPF and eBGP. The route learned from eBGP is selected and added to RTA’s routing table, because the administrative distance of eBGP is less than the administrative distance of OSPF.

On RTA:
router bgp 100
: neighbor 3001::1 remote-as 200
!
address-family ipv6
: distance bgp 150 150 150
: neighbor 3001::1 activate
exit-address-family
On RTB:
router bgp 200
: bgp log-neighbor-changes
: neighbor 1001::1 remote-as 300
: neighbor 2003::1 remote-as 100
 
address-family ipv6
: network 6666::6/128
: neighbor 1001::1 activate
: neighbor 2003::1 activate
exit-address-family
On RTC:
router bgp 300
: neighbor 3002::1 remote-as 200
!
address-family ipv6 network 1000::/64
: neighbor 3002::1 activate
exit-address-family

To check the routes on router RTA, use the show ipv6 route command.

RTA> show ipv6 route
IPv6 Routing Table
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP
Timers: Uptime
 
B 1000::/64 [20/0] via fe80::204:27ff:fe0c:b006, X1, 00:01:07
C 2003::/64 via ::, X1, 00:30:50
B 6666::6/128 [20/0] via fe80::204:27ff:fe0c:b006, X1, 00:01:07
C fe80::/64 via ::, X1, 00:30:53
 

Since RTC is directly connected to RTA, the route from OSPF is actually a better route than the route learned by BGP. To ensure that the route between RTA and RTC is selected for the routing table, you can use the distance command to change the default administrative distance of the BGP route to a higher administrative distance than the OSPF route. For example:

distance bgp 150 150 150

You can also use the backdoor neighbor command to set the BGP route as the preferred route. For example:

On RTA:
router bgp 100
: neighbor 3001::1 remote-as 200
!
address-family ipv6
: network 1000::/64
: backdoor neighbor 3001::1 activate
exit-address-family
 

To check the routes on router RTA, use the show ipv6 route command.

RTA> show ipv6 route
IPv6 Routing Table
 
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP
Timers: Uptime
 
O 1000::/64 [110/2] via fe80::217:c5ff:feb4:57f2, X4, 00:30:53
C 2003::/64 via ::, X1, 00:31:18
B 6666::6/128 [20/0] via fe80::204:27ff:fe0c:b006, X1, 00:00:03
C fe80::/64 via ::, X1, 00:31:21