The goal
Starting from the finished lab-ebgp-ibgp network, make ISP A the primary provider in both directions. Outbound traffic from both routers leaves through ISP A, other networks reach the company through ISP A, and everything moves to ISP B if the ISP A link fails.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Step 1: outbound preference on R1
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
end
clear ip bgp 192.0.2.1 soft inR1. The route map replaces the inbound prefix list; PROVIDER-ONLY is used inside it as the match.
R2#show ip bgp 203.0.113.0 BGP routing table entry for 203.0.113.0/24, version 11 Paths: (2 available, best #2, table default) 64502 192.0.2.5 from 192.0.2.5 (12.12.12.12) Origin IGP, metric 0, localpref 100, valid, external 64501 10.255.0.1 from 10.255.0.1 (1.1.1.1) Origin IGP, metric 0, localpref 200, valid, internal, best
Step 2: inbound preference with prepending on R2
route-map ISPB-OUT permit 10
match ip address prefix-list COMPANY-ONLY
set as-path prepend 64500 64500 64500
router bgp 64500
address-family ipv4 unicast
no neighbor 192.0.2.5 prefix-list COMPANY-ONLY out
neighbor 192.0.2.5 route-map ISPB-OUT out
end
clear ip bgp 192.0.2.5 soft outR2. ISP B now hears a longer path to the company prefix.
Verify on ISP B, which in this lab you can log in to: show ip bgp 198.51.100.0 should show the AS path 64500 64500 64500 64500. On ISP A it should still show just 64500.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Step 3: test failover and recovery
interface GigabitEthernet0/0
shutdownR1, interface to ISP A. Keep a ping to 203.0.113.1 running from the LAN side in another session.
R1#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.2 0 100 0 64502 i
Now run no shutdown and wait for the session to re-establish. R1 should return to ISP A because its local preference is 200, and outbound traffic moves back without any command from you.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Troubleshooting prompts
Local preference is 200 on R1 but R2 does not follow
Check show ip bgp neighbors 10.255.0.1 on R2 for a session in Established state, then look for a weight configured on R2's ISP B neighbour. A weight beats local preference. Remove it with no neighbor 192.0.2.5 weight.
The prepend is configured but ISP B shows only one 64500
The outbound route map has not been re-applied. Run clear ip bgp 192.0.2.5 soft out on R2. Also confirm the route-map sequence matches the prefix; a prefix list typo here makes the sequence match nothing and the implicit deny removes the route entirely.
After no shutdown, traffic stays on ISP B
The session may still be in Active or Idle. Check show ip bgp summary on R1. Once it is Established and ISP A's route returns, local preference 200 wins again.
Technical reference: Cisco, BGP best path selection algorithm. Output above is illustrative.
Check what you learned
After step 1, which router shows localpref 200 for the ISP A path?
Which router is configured to influence how other networks reach the company?
ISP A's link is shut. What does the company lose?