The goal
You are using the course network: the company AS 64500 has R1 connected to ISP A (AS 64501, neighbour 192.0.2.1) and R2 connected to ISP B (AS 64502, neighbour 192.0.2.5), with an iBGP session between R1 and R2 and the company prefix 198.51.100.0/24 behind them. ISP A sends its customer prefix 203.0.113.0/24. Both ISPs currently receive the company prefix from the first lab.
By the end, ISP B hears the company prefix only while the route 203.0.113.0/24 is missing from R2's BGP table. You will test that by failing ISP A on purpose, then find the two situations where the backup starts when it should not.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Step 1: check the starting point
Conditional advertisement works with the BGP table, so confirm that both prefixes are in R2's table first: the watched route from ISP A through R1, and the company prefix that R2 will conditionally send.
R2#show ip bgp Network Next Hop Metric LocPrf Weight Path *>i 203.0.113.0/24 10.255.0.1 0 100 0 64501 i *> 198.51.100.0/24 0.0.0.0 0 32768 i
Check the table, add the two maps, confirm the withhold state, fail ISP A, then restore it.
- Checkboth prefixesin the table
- Configuretwo maps andthe condition
- Confirmstatus showsWithdraw
- Fail ISP Awatch itswitch on
- Restorewatch itswitch off
Step 2: configure the condition on R2
The advertise-map names what is sent to ISP B, which is the company prefix. The non-exist-map names the route that must be missing for the sending to start, which is the prefix from ISP A.
Two prefix lists name the routes. The watched list holds the route whose absence means ISP A has failed. The advertised list holds the company prefix. Two route maps connect the lists to the neighbour command on R2.
ip prefix-list WATCH-ISPA seq 10 permit 203.0.113.0/24
ip prefix-list COMPANY-ONLY seq 10 permit 198.51.100.0/24
route-map ADVERTISE-COMPANY permit 10
match ip address prefix-list COMPANY-ONLY
route-map ISPA-GONE permit 10
match ip address prefix-list WATCH-ISPA
router bgp 64500
address-family ipv4 unicast
neighbor 192.0.2.5 advertise-map ADVERTISE-COMPANY non-exist-map ISPA-GONER2. advertise-map names what is sent when the condition is true. non-exist-map names the route whose absence makes it true. If R2 already has an outbound prefix-list or route map toward ISP B, it must still permit 198.51.100.0/24; the condition decides when the prefix may go, not whether the outbound filter allows it.
A neighbour needs a soft refresh to apply the new policy. Send one, then read the state.
clear ip bgp 192.0.2.5 soft outR2. Asks R2 to run its outbound policy for ISP B again without closing the session. The command prints nothing on success.
R2#show ip bgp neighbors 192.0.2.5 | include Condition Condition-map ISPA-GONE, Advertise-map ADVERTISE-COMPANY, status: Withdraw
R2#show ip bgp neighbors 192.0.2.5 advertised-routes Total number of prefixes 0
Step 3: fail ISP A
On R1, close the session to ISP A. A shutdown stands in for a provider failure, and it removes the watched route quickly. Then wait: R1 withdraws the route from R2 at once, but R2 acts on it at the next condition check.
router bgp 64500
neighbor 192.0.2.1 shutdownR1. This closes the session to ISP A and withdraws 203.0.113.0/24. Use no neighbor 192.0.2.1 shutdown to restore it.
R2#show ip bgp 203.0.113.0 % Network not in table
R2#show ip bgp neighbors 192.0.2.5 | include Condition Condition-map ISPA-GONE, Advertise-map ADVERTISE-COMPANY, status: Advertise
R2#show ip bgp neighbors 192.0.2.5 advertised-routes Network Next Hop Metric LocPrf Weight Path *> 198.51.100.0/24 0.0.0.0 0 32768 i Total number of prefixes 1
ISP-B#show ip bgp 198.51.100.0 BGP routing table entry for 198.51.100.0/24, version 8 Paths: (1 available, best #1, table default) 64500 192.0.2.6 from 192.0.2.6 (2.2.2.2) Origin IGP, metric 0, localpref 100, valid, external, best
The session closes, R1 withdraws the route, R2 notices at the next check, R2 advertises to ISP B, and ISP B starts to send traffic in.
- ISP A session closesR1 stops receiving 203.0.113.0/24Route withdrawn from R2 over iBGP
- R2 waits for its checkStatus still Withdraw until the next scanUp to the scan interval, 60 seconds by default on many releases
- Status becomes AdvertiseR2 sends an UPDATE for 198.51.100.0/24ISP B installs it
- Traffic arrives by ISP BInbound flows follow the new pathProvider caches and policy add their own delay
Step 4: restore ISP A
Remove the shutdown on R1 and watch the reverse. The session returns, the route reappears on R2, and the next check changes the status back to Withdraw. R2 then withdraws the company prefix from ISP B, and traffic returns to the primary path.
router bgp 64500
no neighbor 192.0.2.1 shutdownR1. The session needs time to reach Established and for the route to cross to R2. Read the status again afterwards, not immediately.
The session reaches Established, the route crosses to R2, R2 waits for its next check, and then the status returns to Withdraw so ISP B stops receiving the company prefix.
- ISP A session returnsSession reaches EstablishedR1 learns 203.0.113.0/24 again
- Route crosses to R2iBGP carries the route overR2 table has the watched route
- R2 waits for its checkStatus still Advertise until the next scanISP B still carries inbound traffic
- Status returns to WithdrawR2 withdraws the company prefixInbound traffic returns to ISP A
Record the two times, failure to Advertise and restore to Withdraw. They are your design numbers: they say how long the company is without inbound service when ISP A fails, and how long the backup carries traffic after ISP A returns.
Worked example: how long is the company without inbound service?
The lab uses a shutdown, which is the kindest failure there is. R1 closes the session itself, so R1 knows at once. A real provider failure often leaves the session looking healthy until a timer runs out. The delay before the backup switches on is the detection time plus the wait for the next condition check, so it depends on how the failure happens.
Read the timers that apply to the ISP A session before you do the arithmetic.
R1#show ip bgp neighbors 192.0.2.1 | include hold time Last read 00:00:21, last write 00:00:21, hold time is 180, keepalive interval is 60 seconds
| How ISP A fails | R1 notices after | Wait for next check | Best total | Worst total |
|---|---|---|---|---|
| Lab shutdown on R1 | 0 s | 0 to 60 s | 0 s | 60 s |
| Silent failure, hold time 180 s, keepalives every 60 s | 120 to 180 s | 0 to 60 s | 120 s | 240 s |
| Silent failure with BFD, 300 ms interval, multiplier 3 | 0.9 s | 0 to 60 s | 0.9 s | 60.9 s |
The second row is the number to put in a design review. With default timers, inbound traffic can be missing for up to four minutes before the backup path carries anything, and the shutdown test of this lab alone would have suggested one minute at most. Faster detection (BFD, if the provider supports it on the circuit) shrinks the middle column. Nothing shortens the check interval except what your release allows, so read its documentation before you promise a figure.
The worst case suits a design review, but a typical failure lands between the best and worst case. The table repeats the arithmetic for other ways of noticing the failure and adds the average, with the 60-second check as before.
| How the failure is noticed | Average total | Worst total | Detection range | Check wait, share of average |
|---|---|---|---|---|
| Hold 180 s, keepalives 60 s (defaults) | 180 s | 240 s | 120 to 180 s | 17 percent |
| Hold 90 s, keepalives 30 s | 105 s | 150 s | 60 to 90 s | 29 percent |
| Hold 30 s, keepalives 10 s | 55 s | 90 s | 20 to 30 s | 55 percent |
| BFD, 300 ms interval, multiplier 3 | 30.9 s | 60.9 s | 0.9 s | 97 percent |
Once detection is fast, the check wait is almost the whole delay: with BFD it is 30 of the 30.9 seconds on average. At that point faster detection buys nothing, and only a shorter check interval would help, if the release allows one.
The return trip has the same shape. After ISP A comes back, the session needs time to reach Established and for the route to cross to R2, and then the next check turns the status back to Withdraw. Until it does, ISP B still carries inbound traffic. Measure that too, because it decides how long both paths are in use.
Step 5: two false alarms
The condition watches a route, not a link. Two events that are not an ISP A failure can remove the watched route from R2's table. In both, the company prefix goes out to ISP B while ISP A is healthy, and inbound traffic splits across both providers.
The iBGP session between R1 and R2 fails, or an inbound filter on R1 stops accepting the watched route. In both cases R2 stops seeing the route even though ISP A is fine.
To see the first one, shut the iBGP neighbour on R1 and read the condition status on R2 after the check interval. It changes to Advertise although the ISP A session stays Established. The fix is design, not a command: watch a route that only disappears when ISP A fails, keep the iBGP session redundant, and alert on the condition status so a switch-on is noticed.
Troubleshooting prompts
If the status stays Withdraw while ISP A is down, look for a remaining path to the watched route. If the status shows Advertise but ISP B has nothing, check the outbound policy toward ISP B. If the prefix is still sent after the status returns to Withdraw, look for another source advertising it.
- Stays WithdrawISP A is down, buta path to the route remains
- Advertise, nothing sentstatus is true, butISP B has no route
- Still sentstatus is Withdraw, butthe prefix is still out
The status stays Withdraw although ISP A is down
Run show ip bgp 203.0.113.0 on R2. If any path remains, the condition is false. Look at where it came from: ISP B may also advertise the watched prefix, or a stale iBGP copy may remain. Watch a route that only the primary provides, or remove the other source of it.
The status shows Advertise but ISP B has no route
Check that 198.51.100.0/24 is in R2's BGP table, that the advertise-map matches it exactly, and that no outbound prefix list or route map toward ISP B denies it. The status says the condition is true, not that the route passed every other policy.
The prefix is still advertised after the status returns to Withdraw
Check the status again after a scan interval, then read advertised-routes. If the prefix is still sent, an unconditional route or an extra network statement is advertising it outside the map.
Technical reference: Cisco, BGP conditional advertisement. Output above is an example written for this lesson.
Check what you learned
The status shows Withdraw. What does that mean for ISP B?
You fail ISP A and the status still shows Withdraw after ten seconds. What is the most likely reason?
The iBGP session between R1 and R2 fails while ISP A is healthy. What happens to the condition?
ISP A fails silently with a 180-second hold time and keepalives every 60 seconds. The condition check is 60 seconds. What is the worst case before ISP B receives the company prefix?
Why does the lab's shutdown test understate the real outage?
With BFD detecting at 0.9 seconds and a 60-second condition check, what is the best case and the worst case?
A silent failure uses a 180-second hold time with keepalives every 60 seconds, and the condition check is 60 seconds. On average, how long until ISP B receives the company prefix?
BFD detects the failure in 0.9 seconds and the condition check stays at 60 seconds. Which change would shorten the average delay most?
The status shows Advertise, but ISP B has no route for the company prefix. Which check comes first?