How to Configure BGP Local Preference Attribute

Hello Sathish

Yes that is correct. Just like @davidilles demonstrated, Local Preference is not an attribute that is shared between eBGP peers. It is only shared between iBGP peers. It is a value that indicates which edge iBGP router should be used to reach a particular destination outside of the local AS, and thus it only has meaning to iBGP peers within that AS.

I hope this has been helpful!

Laz

Hello Daniel

Indeed it is the next-hop-self feature that makes the difference in your specific problem. To learn why, and to learn more about this feature, take a look at this lesson:

If you have further questions, please let us know!

I hope this has been helpful!

Laz

This is interesting. How is it that we have the same result by either:

  • Sending the LP route-map in the “out” direction via the “neighbor” command to our iBGP neighbor, or
  • Using the “in” direction from the eBGP neighbor direction.

Thank you

Hell Jorge

The key here is where the route map is applied, and in which direction. Remember, these route maps act upon BGP UPDATEs, and not on actual traffic. The direction has to do with the direction that the BGP UPDATE is sent in.

In the first case that you mention, we have a route map applied in an outbound direction on an iBGP neighbor command. This will cause the local preference to be modified in the UPDATE before it is sent to its neighbor. This works because local preference is included in updates between iBGP routers. So when the neighbor receives it, the local preference for the route in question is modified. (The original sending router does not have this change in its own BGP table because the change was made only in the BGP UPDATE as it exits the router.) In this scenario, the change is made on one router but impacts the neighbor.

You can also change the local preference in an inbound direction, which is your second scenario. Unlike your previous scenario, this can act upon BGP UPDATEs received from either iBGP or eBGP neighbors. This is because the change is internal to the local router. eBGP peers don’t send a local preference, but a router can modify the attribute on an incoming UPDATE before it processes it for its BGP table. It is never transmitted, but it is applied after receiving the UPDATE.

So you can change the local preference in an UPDATE as it leaves your local router to go to an iBGP neighbor, or you can change it in an UPDATE as it is received on your local router, from either an eBGP or iBGP neighbor, before it is processed and applied to the BGP table.

Which you will use depends on several factors, including which routers you have direct control over. Does that make sense?

I hope this has been helpful!

Laz