cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2363
Views
0
Helpful
3
Replies

BGP Local Preference

mandeep62
Level 1
Level 1

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,

local-pref-BGP.png

 

I applied local-preference through route-map for network 8.8.8.8 on Router 1 to choose neighbor R4.

 

R1-BGP.png

 

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.

R2-BGP.png

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

 

3 Replies 3

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 

HTH,
Meheretab

Hi Meheretab,

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

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

and https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/22166-bgp-trouble-main.html?referring_site=bodynav

 

HTH,

Meheretab

HTH,
Meheretab
Review Cisco Networking for a $25 gift card