· 8 min read

RTBH vs FlowSpec vs Cloud Scrubbing: When to Use Each

RTBH vs FlowSpec vs cloud scrubbing comes down to one question: how much of the victim's traffic can you afford to lose while you stop the attack? Use RTBH (remote triggered blackhole) when the attack threatens your uplinks and sacrificing one IP is acceptable, BGP FlowSpec when the attack has a clean signature and your routers support it, and cloud scrubbing over a GRE/BGP tunnel when the target must stay online or the attack is bigger than your edge can filter.

Most networks end up using all three, in order. The rest of this guide compares them and gives you a runbook for moving between them.

The three tools in one paragraph each

RTBH announces the victim /32 (or /128) with a blackhole community. Upstreams or your own edge routers discard all traffic to that address. It is fast and universally supported, but the victim goes offline. The attacker "wins" for that IP, and you protect everyone else.

BGP FlowSpec (RFC 8955 for IPv4, RFC 8956 for IPv6) distributes match-and-action rules over BGP: match destination, protocol, port, packet length, TCP flags, then drop or rate-limit. It is surgical, but it needs hardware and software support, and a bad rule can take down a whole router.

Cloud scrubbing over a tunnel moves your prefixes to a scrubbing edge, filters the traffic there, and returns clean traffic over a GRE tunnel with a BGP session inside. The victim stays online, and your uplinks are protected because the attack never reaches them. The cost is added complexity, some latency, and the need for your own ASN and routable prefixes.

Comparison table

RTBH FlowSpec Scrubbing over GRE/BGP
Collateral damage Victim IP fully down Low if rule is precise; high if too broad Low; legit traffic is delivered
Granularity Destination IP only L3/L4: dst, src, proto, port, length, flags Depends on the scrubbing filters, not your router
Protects uplink saturation Yes, if triggered at upstream Only if enforced upstream/at the edge before the link Yes, traffic is absorbed before your links
Router support Almost everything Juniper, Cisco XR/some XE, Nokia, Arista, others; varies Any router that does GRE and BGP
Time to activate Seconds Seconds, once automated Seconds to minutes (BGP convergence)
Operational risk Self-inflicted outage of one IP Rule errors, TCAM exhaustion Tunnel MTU, routing asymmetry, config errors
Best for Volumetric floods, a single sacrificial target Reflection/amplification with clear port signature Mission-critical targets, large or complex attacks

Check the FlowSpec row against your own platform and software version. Support and the supported match/action set differ a lot between vendors, and between line cards on the same chassis.

When to use RTBH

RTBH fits when:

Two flavors exist. Customer-triggered RTBH to your upstream uses the well-known BLACKHOLE community 65535:666 (RFC 7999) or a provider-specific community; check the upstream's documentation first. Internal RTBH uses a static discard next hop on your own edge. Triggering at the upstream is what relieves a saturated transit link; blackholing only on your own router does not.

Juniper example (internal trigger and export to upstream):

set policy-options community BLACKHOLE members 65535:666
set routing-options static route 203.0.113.10/32 discard
set policy-options policy-statement EXPORT-RTBH term 1 from protocol static
set policy-options policy-statement EXPORT-RTBH term 1 from route-filter 0.0.0.0/0 prefix-length-range /32-/32
set policy-options policy-statement EXPORT-RTBH term 1 then community add BLACKHOLE
set policy-options policy-statement EXPORT-RTBH term 1 then accept

Cisco IOS-style example:

ip route 203.0.113.10 255.255.255.255 Null0 tag 666
route-map RTBH permit 10
 match tag 666
 set community 65535:666 additive
router bgp 64496
 redistribute static route-map RTBH

MikroTik RouterOS v7 (local discard only; add BGP output filters to announce):

/ip route add dst-address=203.0.113.10/32 blackhole comment="RTBH"

Linux with BIRD 2 follows the same idea: a static blackhole route with bgp_community.add((65535,666)) in the export filter.

For more on automation, see our guide on automating RTBH with blackhole communities.

When to use FlowSpec

FlowSpec is the right tool when you can describe the attack in a few fields. A typical example is a reflection attack: UDP, source port 123 or 11211, large packet length, destination 198.51.100.25. A rule drops that and leaves the web server on TCP/443 reachable.

Use it when:

Juniper session configuration (accepting rules from your detector):

set protocols bgp group FLOWSPEC type internal
set protocols bgp group FLOWSPEC neighbor 192.0.2.50 family inet flow no-validate FS-IMPORT
set policy-options policy-statement FS-IMPORT term 1 then accept
set routing-options flow term-order standard

Treat no-validate carefully: it skips the origin validation that normally ensures a rule comes from the router that originates the best unicast route. Use it only on a tightly controlled iBGP session with an import policy that limits rules to your own prefixes.

Cisco IOS-XR and some other platforms have equivalent flowspec address-family configuration. IOS-XE support depends on the platform and release, so verify before you rely on it. To our knowledge MikroTik RouterOS does not implement FlowSpec, so on MikroTik edges you would use RTBH, local firewall rules, or a tunnel. Linux can use FRR or ExaBGP-based setups, but confirm the enforcement path for your version and test throughput.

Key limits: FlowSpec rules consume TCAM or filter memory, and FlowSpec does not help if the attack saturates the link before reaching the router that enforces the rule. We cover safe rule design in our FlowSpec guide.

When to use cloud scrubbing over a GRE/BGP tunnel

Choose scrubbing when:

How it works: the scrubbing edge announces your prefix, so attack and legitimate traffic both arrive there. Clean traffic is returned through a GRE tunnel, and a BGP session inside the tunnel exchanges routes. Details are in our posts on how GRE clean traffic delivery works and the BGP tunnel configuration guide.

Minimal Linux GRE endpoint:

ip tunnel add gre-scrub mode gre local 192.0.2.10 remote 198.51.100.1 ttl 255
ip addr add 203.0.113.2/30 dev gre-scrub
ip link set gre-scrub mtu 1400 up
iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

Common failures are MTU (GRE adds overhead, so clamp MSS), and return-path routing: replies must leave through the tunnel or your normal upstream consistently, or stateful devices will drop traffic. Do not forget to filter by AS-SET so only your prefixes are accepted.

NixGuard Edge is NixMon's service for this model: your prefixes are announced from the scrubbing edge and clean traffic comes back over GRE with BGP inside. It can run always-on or on-demand, and it requires your own ASN and at least one /24. Details on the NixGuard Edge page.

A simple escalation runbook

Detection comes first. Flow-based analytics (NetFlow v5/v9, IPFIX, sFlow) with per-IP or per-prefix bps and pps thresholds tell you who is attacked and with what. Without it, you are guessing which mitigation to pick.

  1. Detect and classify (0-1 min). Identify the victim IP/prefix, protocol, ports, and bps vs pps. Is the link saturated?
  2. Does a clear signature exist? If yes and FlowSpec is supported where it matters, announce a narrow FlowSpec drop or rate-limit rule. Rate-limit first if you are unsure.
  3. Is the link saturating or collateral damage spreading? If yes, trigger RTBH for the victim /32 at the upstream. Accept that this IP is down.
  4. Is the target critical? Skip RTBH where you can, and move the prefix to scrubbing (on-demand) via the tunnel. Verify clean traffic and the return path.
  5. Verify. Watch link utilization, BGP session state, and customer reports. Confirm the rule or route is actually in the FIB.
  6. De-escalate. Withdraw RTBH, remove FlowSpec rules, or switch back from scrubbing after traffic has stayed below thresholds for a set period (use hysteresis to avoid flapping).
  7. Review. Record the timeline, the rule used, and any collateral damage. Tune thresholds.

Pre-plan which hosts are "sacrificial" (RTBH is fine) and which are "protected" (go straight to scrubbing). Making this decision during an attack is slow.

Common mistakes

Where NixMon fits

NixMon detects attacks from NetFlow v5/v9, IPFIX, and sFlow with sub-second traffic analytics. It can trigger BGP blackhole and FlowSpec announcements, use the NixGuard on-prem firewall, or hand off to NixGuard Edge, so the escalation above can run from one place. Mobile apps for iOS and Android send attack alerts. You can start a 15-day free trial with no credit card and test your thresholds on real flow data before enabling any automatic action.

Frequently asked questions

Is RTBH or FlowSpec better against a DDoS attack?

Neither is universally better. FlowSpec is better when the attack has a clear signature and you need to keep the victim online. RTBH is better when the attack is saturating links or no clear signature exists and you can sacrifice one IP. Many networks use FlowSpec first and fall back to RTBH.

Does RTBH stop the attack or just hide it?

It stops the attack traffic from reaching your network or the victim, but it also drops all legitimate traffic to that IP. The attack effectively succeeds against the target. The benefit is protecting the rest of your network and uplinks.

When is cloud scrubbing over a GRE tunnel needed instead of FlowSpec?

Use scrubbing when the attack exceeds your edge or transit capacity, when it is multi-vector or randomized so no simple rule matches, or when the target must remain reachable. It requires your own ASN and routable prefixes (NixGuard Edge needs at least a /24).

Can I use on-demand scrubbing and RTBH together?

Yes. A common design is on-demand scrubbing for protected hosts and RTBH as a last-resort fallback for sacrificial targets or if the tunnel path has problems. Define in advance which hosts get which treatment.

Test your DDoS thresholds on real flow data: start a free 15-day trial.Learn more