BGP Local Preference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2019 10:58 AM - edited 11-23-2019 11:00 AM
Hello Everyone,
I'm trying to understand local preference attribute of BGP. I understand that weight is locally applied to the router and not advertised to any other router whereas local preference is advertised to other routers in the same AS. From the topology attached below,
I applied local-preference through route-map for network 8.8.8.8 on Router 1 to choose neighbor R4.
I can see local-preference set to 200 as expected for network 8.8.8.8.
For R2 which is an IBGP neighbor of R1, I can see the local-preference of 200 sent by R1 for network 8.8.8.8, but why R2 is selecting the best path for 8.8.8.8 through R3 instead of R4.
As seen on R2, It is selecting best path though 192.168.4.3 which is R3, not through 192.168.2.4 which is R4.
Shouldn't it select R4 as well because on R1 I configured local-preference of 200 through neighbor R4.
ip prefix-list allow 8.8.8.8 seq 5 permit 8.8.8.8/32
route-map allow-local permit 10
match ip address prefix list 8.8.8.8
set local-preference 200
applied route-map for neighbor 192.168.2.4
Am I missing something? I was thinking, R2 should also select best path for 8.8.8.8 through 192.168.2.4 because of higher local preference sent by R1.
Thanks
Mandeep
- Labels:
-
Other Routing
-
Routing Protocols
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2019 11:00 PM
Hi Mandeep,
Your understanding of local-preference is correct. The only issue I see here is that you missed part of the configuration — neighbor R2 next-hop-self — on R1 towards R2. Since you missed that config, R2 does not know how to reach to 192.168.2.0/24 network; as a result, it could not select the route through R1 (even if it has higher local-preference). The alternative solution is to advertise the 192.168.2.0/24 network to R2.
HTH,
Meheretab
Meheretab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2019 08:13 AM
Thanks for the reply. I did apply next-hop-self before on R1 before which works. I was just trying to understand the behaviour. In this kind of scenario, Packet destined to 8.8.8.8 will always go to R1 from IBGP neighbors of R1 as R1 has selected the best path to reach 8.8.8.8 through R4. If route to R1 becomes unavailable for R2, it will consider other path.
Thanks
Mandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2019 03:55 PM
That is correct. As long as the network is reachable through R1, R2 routes its traffic through R1 (assuming you either configured next-hop-self or advertised the transit network to R2). When R1 goes down, R2 uses other paths.
If you want to learn more about BGP best path selection algorithm and troubleshooting, you can go https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/13753-25.html
HTH,
Meheretab
Meheretab
