Why the default choice is not what you want
In the course lab each router has one eBGP path to 203.0.113.0/24 and one iBGP path from its neighbour. All the early attributes tie, so the rule eBGP over iBGP decides: R1 leaves through ISP A and R2 leaves through ISP B. The company is using both providers equally, which may not match what it pays for.
The goal is simple: while ISP A works, both routers should send outbound traffic through it. If ISP A fails, the path through ISP B should take over without anyone logging in.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Local preference is the right tool. It is compared second in the best-path order, it is shared with every iBGP peer, and a higher value wins. Setting 200 on the paths from ISP A makes them beat the default 100 everywhere in AS 64500.
Set local preference with a route map
A route map matches routes and sets attributes on them. Here we match the one prefix we expect from ISP A and set its local preference. A route map applied inbound also filters: anything that does not match a permit sequence meets the implicit deny and is rejected. So this route map replaces the earlier inbound prefix list on that neighbour.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
route-map ISPA-IN permit 10
match ip address prefix-list PROVIDER-ONLY
set local-preference 200
router bgp 64500
address-family ipv4 unicast
no neighbor 192.0.2.1 prefix-list PROVIDER-ONLY in
neighbor 192.0.2.1 route-map ISPA-IN in
exit-address-familyR1, global configuration mode. PROVIDER-ONLY is the exact 203.0.113.0/24 prefix list from the lab. Only R1 needs this change; R2 learns the value over iBGP.
Changing an inbound policy does not rewrite routes already accepted. Ask ISP A to send its routes again with a soft reset, which keeps the session up. The next lesson covers why this works.
clear ip bgp 192.0.2.1 soft inR1, privileged EXEC mode. Re-applies the inbound policy to the routes ISP A sends again, without resetting the session.
Verify on both routers
Check R1 first, then R2. The point of the lesson is that R2 changed without being configured.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
R2#show ip bgp Network Next Hop Metric LocPrf Weight Path *> 198.51.100.0 0.0.0.0 0 32768 i *>i 203.0.113.0 10.255.0.1 0 200 0 64501 i * 192.0.2.5 0 0 64502 i
Prove it with traffic: on R2, traceroute 203.0.113.1 source 198.51.100.3 should now cross R1 and ISP A instead of leaving through ISP B.
Weight: faster, but only for one router
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Weight is checked before local preference. It is a Cisco setting on one router, so use it when only that router needs an exception.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
router bgp 64500
address-family ipv4 unicast
neighbor 192.0.2.1 weight 300R1: every path learned from ISP A gets weight 300 on R1 only. R2 is not affected, so a stray weight can leave the two routers disagreeing about the exit.
Sharing the load: a different exit for different destinations
One local preference for everything sends all outbound traffic through one provider and leaves the other link idle. If both links are paid for, you can split by destination: prefer ISP A for some destination prefixes and ISP B for the rest. The inbound route map matches the prefixes and sets a different value for each.
ip prefix-list VIA-ISPA seq 5 permit 203.0.113.0/24
ip prefix-list VIA-ISPA seq 10 permit 203.0.114.0/24
!
route-map FROM-ISPA permit 10
match ip address prefix-list VIA-ISPA
set local-preference 200
route-map FROM-ISPA permit 20
set local-preference 100
!
route-map FROM-ISPB permit 10
match ip address prefix-list VIA-ISPA
set local-preference 100
route-map FROM-ISPB permit 20
set local-preference 200
!
router bgp 64500
address-family ipv4 unicast
neighbor 192.0.2.1 route-map FROM-ISPA in
neighbor 192.0.2.5 route-map FROM-ISPB inR1 and R2. The two listed destinations leave via ISP A. Everything else leaves via ISP B. Each link carries traffic, and each is the backup for the other, because the other provider's path is still in the table with a lower value.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
How much of the internet table should you accept
On small screens, swipe sideways or focus the diagram and use the arrow keys.
The provider can send you three amounts of routing information, and the amount decides how much outbound control you have.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Most enterprise edges start with default only from each provider and local preference to rank the two defaults. Move to a partial or full table only when you need the control, and make sure the routers can hold it.
Proving the traffic moved
The BGP table shows the choice, not the packets. After a change, check three things, in this order: the winning path on each router, the routing table entry, and the actual path of a packet.
show ip bgp 203.0.113.0
show ip route 203.0.113.0
traceroute 203.0.113.10 source 198.51.100.1R1 and R2. The BGP table shows the best path and local preference, the routing table shows what is installed, and a traceroute sourced from a company address shows the first hop is the provider you chose.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
What this does not do
Local preference changes your exit, not your entrance. Other networks still choose how to reach the company prefix, and that depends on what each ISP receives from you. Also remember the failure case: because the ISP B path stays in the table, the company keeps working if ISP A fails. Test it in the path-selection lab.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Technical reference: Cisco, BGP best path selection algorithm. Output above is illustrative.
Check your outbound policy
You set local preference 200 on R1 for ISP A routes. R2 still uses ISP B. What is the most likely cause?
After editing an inbound route map, show ip bgp still shows the old local preference. What should you do?
Which setting would let only R1 prefer ISP A without telling R2?