Always-On vs On-Demand DDoS Protection: BGP Diversion Guide
Always-on vs on-demand DDoS protection comes down to one question: is your traffic scrubbed all the time, or only after an attack is detected and you divert it? Always-on keeps your prefix pointed at the scrubbing path permanently, so there is no detection delay. On-demand keeps traffic on your normal path and uses BGP to pull it into a scrubbing center only when an attack starts.
Neither model is universally better. The right choice depends on how fast attacks hurt you, how much latency you can tolerate, and how reliable your detection is. This guide explains the difference, what "detection time" really includes, and how BGP moves traffic to a scrubbing center, with a working configuration example.
Always-on vs on-demand: the core difference
| Always-on | On-demand | |
|---|---|---|
| Normal traffic path | Through the scrubbing network, always | Direct to your network |
| Attack start | Filtered from the first packet | Hits you until diversion completes |
| Detection needed | Not required for routing | Required (flow, thresholds, or manual) |
| Extra latency | Small, constant (path via scrubber) | None until diversion |
| Operational effort | Low once set up | Higher: triggers, runbooks, testing |
| Typical fit | Game servers, hosting, anything latency-tolerant but downtime-intolerant | Networks with strong monitoring and a tight latency budget |
A third pattern is common: always-on routing with on-demand filtering strictness. Traffic always arrives via the protected path, and you tighten rules during an attack.
What "detection time" actually includes
When people ask how fast on-demand protection reacts, they usually mean one number. In practice it is the sum of several delays:
- Telemetry delay. NetFlow/IPFIX/sFlow records are exported on a timer. Active timeouts of 30–60 seconds are common, and some exporters batch longer.
- Detection logic. Threshold or baseline checks often need a few consecutive intervals to avoid false positives.
- Decision and trigger. An automated script or a human approving the diversion.
- BGP propagation. The announcement has to be accepted by the scrubbing network and, if you are re-originating the prefix, propagate to the internet. Convergence varies by topology and is not instant.
- Tunnel and return path warm-up. The clean-traffic path (usually GRE) must already be up and tested.
The attack runs at full strength during all five steps. For a volumetric flood that saturates your uplink, that window is the outage. This is why on-demand works best when upstream capacity is larger than the attack's peak during the delay, or when your detection is automated and tuned.
Always-on removes steps 1 through 4 from the critical path entirely. You pay for that with constant path inflation and the need to trust the scrubbing path with all of your production traffic.
Reducing detection time for on-demand
- Use sampled flow export with a short active timeout where your router supports it.
- Alert on rate of change (packets per second to a single destination), not only absolute thresholds.
- Detect per destination /32 or per prefix, not just per interface.
- Automate the trigger. A page at 3 a.m. followed by a manual command adds minutes.
A flow-based monitoring and detection platform such as NixMon is designed for this role: it analyzes flow data to spot attacks and can feed an alert into whatever triggers your diversion.
How BGP diverts traffic to a scrubbing center
BGP does not "filter" anything. It changes where packets go. The scrubbing flow has three parts:
- Attract. The scrubbing network announces your prefix (or you announce it to them), so internet traffic for that prefix flows to the scrubbing center.
- Clean. The scrubbing center drops attack traffic and keeps legitimate traffic.
- Return. Clean traffic is delivered back to you, typically through a GRE tunnel, because the scrubbing center cannot simply route it back via the same BGP path without looping.
Two common ways to attract traffic:
- Provider originates your prefix. You authorize the scrubbing provider's ASN (RPKI ROA, route object, letter of authorization) and ask them to announce it. This is typical for always-on.
- You announce to the scrubbing session. You keep originating the prefix, but toward the scrubbing network over a BGP session. In on-demand mode you enable that session (or change its export policy) only during an attack.
Most IPv4 networks filter prefixes longer than /24, so a diversion needs to be a /24 or shorter. You cannot rely on announcing /32s to pull a single host's traffic across the public internet. For single-host mitigation inside a network, see RTBH instead.
Example: on-demand diversion with BIRD 2
This sketch uses documentation ranges. Your ASN is AS64496, your prefix is 198.51.100.0/24, and the scrubbing network is AS64500 reachable at the tunnel address 192.0.2.1.
# /etc/bird/bird.conf (excerpt)
define MY_ASN = 64496;
define SCRUB_AS = 64500;
filter export_to_scrub {
if net = 198.51.100.0/24 then accept;
reject;
}
protocol static my_prefix {
ipv4;
route 198.51.100.0/24 blackhole;
}
protocol bgp scrub {
local 192.0.2.2 as MY_ASN;
neighbor 192.0.2.1 as SCRUB_AS;
disabled; # on-demand: keep down until an attack
ipv4 {
import none;
export filter export_to_scrub;
};
}
Trigger and clear:
# Start diversion
birdc enable scrub
# Verify the session and the announced route
birdc show protocols scrub
birdc show route export scrub
# End diversion after the attack has ended
birdc disable scrub
Before relying on this, confirm that the GRE tunnel is up, that your ROA covers the origin AS the scrubbing network will use, and that the max-length matches the prefix you announce. For tunnel MTU and MSS tuning, see our GRE tunnel DDoS protection guide.
Always-on in practice with a BGP tunnel
If you have your own ASN and IP block, an always-on setup usually means a GRE tunnel to the protection network with a BGP session running inside it. Clean traffic arrives through the tunnel, and your prefix is announced via the protection network at all times. Nixcon operates AS40368 and provides this through NixGuard Edge, described on the DDoS protection and firewall page. Your ASN is added to the AS-NIXCON AS-SET, and ownership is validated through RPKI ROA and RIR/IRR records.
You can inspect how routes appear from different locations (Izmir, Frankfurt, and the US) with the public looking glass using BGP route, ping, and traceroute queries.
Which model should you choose?
Choose always-on if:
- Attacks arrive without warning and even a short outage is costly (game servers, hosting platforms).
- You lack the staff or automation to run a diversion runbook reliably.
- Your traffic is sensitive to attacks that ramp up fast.
Choose on-demand if:
- You have strong flow telemetry and tested automation.
- Latency to your normal path matters and the added hop through a scrubber is unacceptable.
- Attacks are rare and your own upstream can absorb the detection window.
A middle path is to run always-on for the prefixes hosting critical services and keep on-demand for the rest.
Common mistakes and fixes
- Diverting a prefix longer than /24. It will not propagate widely. Divert a /24 or shorter, or use RTBH for single hosts.
- ROA mismatch. The scrubbing ASN is not authorized, so networks that validate RPKI drop the route. Create or update the ROA before you need it.
- Untested GRE return path. Diversion works, but clean traffic never reaches you. Test the tunnel under normal conditions, not during an attack.
- MTU problems. GRE adds overhead, so large packets fragment or drop. Lower the tunnel MTU and clamp TCP MSS.
- Asymmetric egress. Your replies leave via the direct path while inbound arrives through the tunnel. Stateful firewalls and some scrubbing setups break on this. Decide deliberately how outbound traffic is routed.
- Withdrawing too early. Pulling the diversion the moment traffic looks calm can restart the attack. Hold the diversion for a defined period and withdraw once traffic stays normal.
- Flapping triggers. Rapid enable/disable cycles risk route dampening. Add hysteresis to your automation.
- No dry run. Run a planned diversion in a maintenance window and measure time from trigger to clean traffic. That measured number is your real detection-to-mitigation time.
Quick readiness checklist
- Flow export configured, with a tested alert path.
- ROA, route objects, and AS-SET cover the origin AS you will use.
- GRE tunnel up with MTU and MSS verified.
- Runbook with enable, verify, and withdraw commands.
- A drill completed and timed.
Whichever model you pick, measure the result. A diversion you have never timed is a guess, not a defense.
Frequently asked questions
What is the main difference between always-on and on-demand DDoS protection?
Always-on routes all traffic through a scrubbing network continuously, so attacks are filtered from the first packet. On-demand keeps traffic on your normal path and diverts it via BGP to a scrubbing center only after an attack is detected.
Why does on-demand protection have a detection delay?
The delay is the sum of flow export timers, detection logic, the trigger decision, BGP propagation, and tunnel readiness. The attack continues at full strength during that whole window.
Can I divert a single IP address with BGP?
Not across the public internet in most cases. IPv4 prefixes longer than /24 are commonly filtered, so diversion normally uses a /24 or shorter. For a single host inside a network, RTBH is the usual tool.
How does clean traffic get back to my server after scrubbing?
Typically through a GRE tunnel from the scrubbing network to your router or server. You need to set the tunnel MTU and TCP MSS correctly and decide how outbound traffic is routed to avoid asymmetry problems.