How to Configure BGP Local Preference Attribute

Hello Dakshinamurthy

It depends on what you mean by incoming traffic. You see, the “in” and “out” keywords used in the route maps do not refer to the direction of user traffic, but to the direction of exchanged BGP updates.

So for the following command applied to R4:

R4(config-router)#neighbor 192.168.13.1 route-map LOCALPREF out

the result is, any BGP update containing a route that is sent from R4 to neighbor 192.168.13.1 (R3) will have the LOCALPREF route-map applied to it. BGP updates from R4 to R3 are considered outbound from the point of R4. So if the route-map changes the local preference to, say, 500, then such a command will make all routes shared by R4 with R3 will have their localpref changed to 500.

If we’re talking about user traffic, then no. LocalPref will only affect the choice of path to exit the local AS for a particular prefix. If you have two or more eBGP routers within your AS, and they both have a route to the same prefix via eBGP, the local pref can be used to prefer one over the other.

Inbound traffic can be influenced using MED or AS-PATH prepending, but even so you do not have ultimate control over incoming routing, only your ISP can do that. For more info about influencing incoming traffic, take a look at the following post:

I hope this has been helpful!

Laz