What is BGP Local Preference Attribute and How to Set It?
What is BGP Local Preference Attribute? BGP Local Preference Attribute is an optional non-transitive BGP attribute that is…
BGP conditional advertisement advertises a prefix to a neighbour only when a condition about another prefix is met. It is the tool for active/backup multi-homing where you want a provider used only when the primary path has actually failed.
The problem it solves: normally, if you advertise your prefix to both ISPs, both will attract traffic and you have no control over the split. If you advertise to only one, you have no failover. Conditional advertisement gives you both, advertise to the backup provider only when the primary is down.
| Command pair | Behaviour | Used for |
|---|---|---|
advertise-map + non-exist-map | Advertise only when the tracked prefix is absent | Backup link, advertise when the primary fails |
advertise-map + exist-map | Advertise only when the tracked prefix is present | Advertise only while a dependency is reachable |
non-exist-map is by far the more common of the two.
Three pieces have to line up:
Two details that surprise people:
AS 65001 is multi-homed to ISP-A (primary) and ISP-B (backup). It owns 203.0.113.0/24 and wants that advertised to ISP-B only when the ISP-A path is gone. It tracks a prefix ISP-A originates, 198.51.100.0/24, as the health indicator.
! Prefix we conditionally advertise
ip prefix-list OUR-PREFIX seq 5 permit 203.0.113.0/24
! Prefix whose disappearance means ISP-A is down
ip prefix-list ISP-A-PREFIX seq 5 permit 198.51.100.0/24
route-map ADVERTISE-OURS permit 10
match ip address prefix-list OUR-PREFIX
route-map TRACK-ISP-A permit 10
match ip address prefix-list ISP-A-PREFIX
router bgp 65001
address-family ipv4 unicast
neighbor 198.51.100.1 remote-as 64500 ! ISP-A
neighbor 203.0.113.254 remote-as 64501 ! ISP-B
neighbor 203.0.113.254 advertise-map ADVERTISE-OURS non-exist-map TRACK-ISP-AWhile 198.51.100.0/24 is in the BGP table, 203.0.113.0/24 is withheld from ISP-B. When it disappears, the advertisement to ISP-B starts within one scan interval.
Router# show ip bgp neighbors 203.0.113.254 | include Condition
Router# show ip bgp neighbors 203.0.113.254 advertised-routes
Router# show ip bgp 198.51.100.0
Router# debug ip bgp updatesThe first command reports the condition status directly:
Condition-map TRACK-ISP-A, Advertise-map ADVERTISE-OURS, status: WithdrawWithdraw means the tracked prefix exists and the advertisement is suppressed. Advertise means it is gone and the prefix is being sent.
This is the decision that determines whether the whole thing works, and it is easy to get wrong.
Conditional advertisement is not always the right tool. Compare it against the simpler options:
| Technique | Controls | Complexity | Effectiveness |
|---|---|---|---|
| AS-path prepending | Inbound path preference | Very low | Advisory, remote networks may ignore it |
| Communities | Inbound, via the ISP’s policy | Low | Good, if your ISP supports the community |
| MED | Entry point into one AS | Low | Only within a single neighbouring AS |
| Advertising a more specific prefix | Inbound, strongly | Low | Very effective, longest match always wins |
| Conditional advertisement | Whether to advertise at all | Higher | Absolute, but slow (60 s scan) |
Prepending is usually tried first and is often enough. Adding your own ASN several times makes the backup path look longer, and most networks will prefer the shorter one. It is advisory rather than binding, a remote network with a local preference policy will ignore your prepends entirely, but it costs one line of configuration.
Conditional advertisement is what you use when advisory is not good enough: when the backup provider’s link is expensive, metered, or genuinely must carry nothing until it is needed.
non-exist-map advertises when the tracked prefix is absent, the backup-link case. exist-map advertises when it is present, used when your advertisement depends on something else being reachable.
Up to 60 seconds, because the condition is evaluated on the BGP scan timer, plus normal convergence time. It is not a fast-failover mechanism.
Check that the prefix in the advertise-map is actually in the BGP table, that the tracked prefix has genuinely disappeared (show ip bgp <prefix>), and that the route maps match what you think, a prefix-list with the wrong length modifier is a common cause.
Try prepending first, it is one line and usually sufficient. Use conditional advertisement when you need the backup path to carry genuinely no traffic until the primary fails, and can accept the slower failover.
Yes, the mechanism is the same, though the use case is far less common. It is normally applied to eBGP neighbours where you are controlling what an external provider sees.
The non-exist-map can match multiple prefixes, but the condition is satisfied when any matched prefix exists. To require all of them to disappear, you need separate logic, which is usually a sign the design should be simplified. See the BGP configuration guide for the wider policy toolkit.
One response to “BGP Conditional Advertisement — Advertise Map and Non-Exist Map”
[…] BGP you can convert advertisement of routes based on condition. If a route exists or not exist, they only advertise particular prefixes to […]