Working with Local Preferences
Background
One of my consulting customers request that I review the bgp configuration for errors. I asked what problems he experienced, he advised me that every time his primary Internet connection dropped or bounced or if he rebooted the router he would have to bounce his secondary line after to secure the primary internet connection. I informed him this was natural because you are only receiving a default route from both of your ISP’s and each has only one AS for path selection so whenever you reboot your equipment the first bgp connection to establish is your primary route.
Why?
BGP routes learned from outside (eBGP) select paths on mostly on AS Path length. If you have the same AS path length the router will select the first route to appear in the BGP table. You as the administrator must tell BGP to select the routes you prefer.
Local Preference Vs. Weight
The only Difference between Weight and Local Preference is Local Preference is distributed within your local AS. Weight is Cisco Defined and Router Specific only. Both are a numeric value and you set with the higher value being the preferred route.
Default Local Preference 100
Default Weight 0
Why use Local Preference
I selected Local Preference because my customer might split the BGP connections onto 2 separate routers and run HSRP (Hot Standby Routing Protocol) to diversify the network. Local preference will propagate to all routers with the same AS. This will work perfect once the
Network Diagram
Router C
router bgp 300
no synchronization
bgp log-neighbor-changes
network 208.229.144.0 mask 255.255.252.0
aggregate-address 208.229.144.0 255.255.252.0
neighbor 10.0.0.49 remote-as 100
neighbor 10.0.0.49 description GW-to-L3
neighbor 10.0.0.49 soft-reconfiguration inbound
neighbor 10.0.0.49 prefix-list 10288-out out
neighbor 10.0.0.49 route-map gw-l3-out in
neighbor 10.0.0.8 remote-as 200
neighbor 10.0.0.8 description GW-to-Cogent
neighbor 10.0.0.8 soft-reconfiguration inbound
no auto-summary
route-map gw-l3-out permit 10
set local-preference 110
Verify Commands
Show ip bgp
BGP table version is 3722274, local router ID is 208.229.147.17
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal
Origin codes: i – IGP, e – EGP, ? – incomplete
Network Next Hop Metric LocPrf Weight Path
* 0.0.0.0 10.0.0.8 0 0 33321 i
*>i 10.0.0.49 0 110 0 33321 i
As you can tell the best route (indicated by >) is the one with LocPrf of 110
