The next BGP attribute we're going to look at is the local preference. Now if you have a look at the diagram, we have four autonomous systems displayed there. We're sitting in AS 400 and we see that AS 100 is originating 160.10.0.0/16 address block. How do we get from AS 400 to AS 100? Now if we are just ourselves, we walk into the office one morning and we decide well which way should I walk into the office? Should I walk into the office through the front door or should I walk into the office through the back door? You can make a decision, it depends how you feel that morning. What you had for breakfast, whether you had coffee or tea to drink or something. But you can't really tell a router, "oh just, you know, just do what you feel like." What we actually do is, we use an attribute called local preference. Where you, the network operator, can configure BGP to give preference to one particular path over another. So what we're doing in this case is, if we attach a local preference of 800 for the BGP announcement of 160.10.0.0/16 as we hear it from AS 300, and we attach a local preference of 500 to the announcement coming from AS 200. And then we look inside AS 400 we'll actually see two paths, one path with a local preference 500, the other path with a local preference of 800. So there are two paths in our autonomous system. Highest local preference wins and so the best path from us to AS 100, will follow the path with local preference 800 set on it, in other words, from AS 400 to AS 300 to AS 100. So local preference is used to steer traffic out of our network, we attach local preference to incoming BGP announcements, the highest local preference determines the outbound path. So summarizing all this, local preference is a non transitive and optional attribute, you don't have to set it. And if you don't set it most operating systems will use a default value of 100. It's local to the AS only, so local preference set in your autonomous system will not be used by any other autonomous system. It's used to influence the BGP path selection process as we will see in a while. And it determines the best path for outbound traffic and just a reminder that path with the highest local preference wins. We've got some sample configurations here on the next slide, this one shows how it might be configured on Cisco IOS. And it shows the example from the diagram. So we have our configuration of a router in BGP AS 400. Neighbors talking to AS 300. We have a route map, which basically is Cisco IOS policy language. Which is looking for a prefix 160.10.0.0/16, and if the prefix is found it will set local preference to 800. If the prefix is not found, nothing happens the prefix is just passed through. So that's the sample configuration as you might find it on a Cisco IOS speaking router.

© Produced by Philip Smith and the Network Startup Resource Center, through the University of Oregon.

Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
This is a human-readable summary of (and not a substitute for) the license. Disclaimer. You are free to: Share — copy and redistribute the material in any medium or format Adapt — remix, transform, and build upon the material The licensor cannot revoke these freedoms as long as you follow the license terms. Under the following terms: Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. NonCommercial — You may not use the material for commercial purposes. No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.