Lesson 8 of 9 · 23m
Traffic Engineering and Failover Without Self-Inflicted Outages
Inbound and outbound traffic engineering require different tools; graceful failover depends on understanding what you control, what others control, and how convergence behaves under failure.
The uncomfortable truth of BGP traffic engineering is that you control outbound path selection far more directly than inbound path selection. You can set local preference for traffic leaving your network. For traffic coming in, you are only influencing other people's decisions. Expect approximate steering, not joystick control.
Outbound control
Outbound engineering is mostly local:
primary provider import: local-preference 200
secondary provider import: local-preference 100
specific prefixes: selective overridesThis is deterministic inside your AS, subject to route availability. Use communities and route maps so the intent is readable. Do not implement one-off exceptions directly on individual border routers unless you enjoy inconsistent behavior during partial failures.
Inbound influence tools
The standard tools are:
- announce the same aggregate consistently everywhere
- selectively announce more-specific prefixes
- AS-path prepend on less-preferred providers
- MED where the same neighboring AS has multiple links to you
- provider traffic-engineering communities, where supported
to provider A: 203.0.113.0/24
to provider B: 203.0.113.0/24 with two prependsThis often works. It does not always work. A large peer may prefer a short direct path regardless of your prepends because its local policy prioritizes peer traffic economics.
Failover is not instant
When a provider fails, several things must happen: session or forwarding failure detection, route withdrawal propagation, alternate path selection, and convergence in upstream networks. Some remote networks may not see the withdrawal immediately. TCP retransmissions and application timeouts add their own delay.
Test the real failure modes:
shut the interface
stop the BGP process
disable the neighbor administratively
drop forwarding while keeping control plane aliveThose are not equivalent. A BGP withdraw is cleaner than a silent forwarding blackhole. Graceful shutdown mechanisms can drain traffic before maintenance, but only if peers honor them.
Anycast changes the model
Anycast announces the same prefix from multiple locations and lets routing choose a topology-near instance. It is powerful for DNS and some edge services, but routing changes can move flows between sites. Stateless or globally synchronized services tolerate this better than stateful ones. Do not adopt anycast because it sounds resilient; adopt it because the application's failure semantics fit.
Field notes
- Test failover at realistic traffic levels, not just with a single ping.
- Overly specific traffic engineering creates fragile exception state that future staff will not understand.
- A backup path with enough capacity for average traffic may still fail during peak plus attack traffic.
- Document why each prepend or community exists; the original reason usually disappears before the configuration does.
- If inbound distribution matters deeply, direct peering and CDN placement often beat clever BGP knobs.
Was this lesson helpful?