What is LOCAL_PREF?
Local Preference
LOCAL_PREF (Local Preference) is a BGP attribute that tells every router inside your AS which exit to prefer for a destination; the highest value wins.
It's a well-known discretionary attribute carried only on iBGP sessions: you set it on routes as they arrive at your edge, usually in an inbound route-map, and it travels with them to every other router in the AS so they all make the same choice. It is never sent to eBGP neighbours, so it only affects your own network's decisions. Routes without an explicit value get a default of 100. In best-path selection it's compared very early, before AS_PATH length, so it overrides the shortest-path choice. (Cisco and FRR also have a router-local "weight" that is checked even before it, but weight is not part of the BGP protocol and isn't shared with other routers.)
Because LOCAL_PREF controls where your traffic leaves, it's the main tool for outbound traffic engineering. A common scheme ranks routes by business relationship: customer routes highest (for example 200), then settlement-free peers (150), then paid transit (the default 100), so traffic goes to whoever is cheapest to reach. It also explains a common surprise: you can prepend your AS_PATH all you like, but if a provider has set a higher LOCAL_PREF on your route via one link, its routers will still use that link, because LOCAL_PREF is compared first. Don't confuse it with MED, which is sent to a neighbouring AS to suggest how traffic should enter, and where lower wins. See also AS_PATH. The BGP Fundamentals lesson's best-path simulator lets you change LOCAL_PREF and watch the winner change, and BGP communities, prepending and RTBH shows its effect on prepending.
Lessons that use LOCAL_PREF
- BGP FundamentalsTeaches this term · Intermediate · 75 min
How the Border Gateway Protocol glues the internet together: autonomous systems, sessions, path attributes, best-path selection, iBGP scaling and a hands-on eBGP lab with real FRR configuration.
- RPKI and Route Origin ValidationIntermediate · 70 min
Cryptographically signed routing origins: the RPKI trust chain, creating safe ROAs, Valid/Invalid/NotFound, validators and RTR, a real FRR + StayRTR lab, and what ROV can't stop (forged origins, leaks), plus where ASPA comes in.
- Setting up VyOS with basic BGPIntermediate · 50 min
Build a VyOS edge router from scratch: one upstream transit provider, one Internet Exchange route server, and the import and export policy that keeps both safe. Every command and output comes from a real VyOS lab.