· 7 min read

Flow-Based DDoS Detection: Thresholds, Baselines, Automation

Flow-based DDoS detection works by comparing per-destination traffic rates, measured in packets per second (pps) and bits per second (bps), against thresholds and baselines, then triggering an alert or mitigation when the rates stay abnormal. Good detection depends less on the flow protocol you use and more on how you choose thresholds, how long you wait before acting, and what you automate.

This guide covers the tuning side: which metrics matter, how to build a baseline, how to avoid false positives, and how to wire detection to automatic mitigation without causing your own outage. For sampling rates and exporter choices, see our separate comparison of NetFlow, IPFIX, and sFlow.

What flow data can and cannot tell you

Flow records summarize conversations: source and destination IP, ports, protocol, TCP flags, packet and byte counts, and timestamps. They do not carry payloads. That makes flow good for volumetric and protocol-level attacks (UDP floods, amplification, SYN floods, ICMP floods, fragments) and weak for application-layer attacks that look like normal HTTP requests.

Two practical consequences:

Measure pps first, bps second

Bandwidth-only thresholds miss the attacks that hurt most. A small-packet flood can saturate a firewall, router line card, or game server's network stack at a modest bit rate. A large-packet amplification flood does the opposite: high bps, moderate pps.

Track both, per destination IP (and per prefix for wider attacks). To convert sampled flow data:

pps = (sampled_packets × sampling_rate) / interval_seconds
bps = (sampled_bytes × 8 × sampling_rate) / interval_seconds

You can inspect a collector's data quickly with nfdump:

# Top destination IPs by packets in the latest capture file
nfdump -r /var/flow/nfcapd.202506011200 -s dstip/packets -n 10

# Narrow to UDP only
nfdump -r /var/flow/nfcapd.202506011200 -s dstip/packets -n 10 'proto udp'

Remember that nfdump shows raw sampled counts unless your collector is configured to scale them.

Build thresholds in layers

A single global number does not work. Use three layers instead.

  1. Static floor. A minimum rate below which you never alert, regardless of baseline. This stops a quiet server going from 50 pps to 500 pps from paging someone.
  2. Dynamic baseline. A rolling average of normal traffic per destination, with a multiplier.
  3. Hard ceiling. A rate your service or upstream link cannot tolerate, which triggers mitigation immediately.

An illustrative profile for a single game server at 203.0.113.10 (these values are examples, not recommendations):

Metric Floor Baseline multiplier Hard ceiling
Total pps 20 kpps 4× 150 kpps
Total bps 100 Mbps 3× 800 Mbps
UDP from source port 53/123/11211/1900 5 Mbps n/a 50 Mbps
TCP SYN-only pps 5 kpps 5× 40 kpps
ICMP pps 1 kpps n/a 10 kpps

Derive your own numbers from at least two weeks of data, including your busiest day. Use the 95th or 99th percentile as "normal peak," not the average.

A simple baseline with EWMA

An exponentially weighted moving average adapts to gradual growth without chasing an attack. Update the baseline only when traffic is not flagged as an attack, or the attack will teach your system that it is normal.

ALPHA = 0.05  # smoothing; lower = slower to adapt

def update(baseline, sample, under_attack):
    if under_attack:
        return baseline          # freeze during incidents
    return ALPHA * sample + (1 - ALPHA) * baseline

def is_anomalous(sample, baseline, floor, mult, ceiling):
    if sample >= ceiling:
        return True
    return sample > floor and sample > baseline * mult

Keep separate baselines by hour of week. Traffic at 20:00 on Saturday is not comparable to 04:00 on Tuesday.

Match on attack signatures, not just volume

Volume alone cannot tell a flash crowd from a flood. Add conditions that describe the shape of the traffic:

Requiring volume plus one signature condition removes most noise.

Reduce false positives

False positives are expensive when mitigation is automatic, because legitimate users get dropped. The most effective controls:

Automatic mitigation without self-inflicted outages

Automation should escalate in steps, with the least destructive action first.

  1. Alert only. Notify via chat or email with top sources, ports, and rates.
  2. Targeted filtering. Apply ACLs or FlowSpec rules for clear signatures, such as UDP source port 11211 toward the victim.
  3. Divert to scrubbing. Move the victim prefix to a scrubbing path through a BGP announcement or tunnel so clean traffic returns.
  4. Blackhole. Use RTBH as a last resort when the attack threatens the rest of your network. It completes the attack for that /32.

A minimal BIRD 2 example of a triggered blackhole, using the well-known blackhole community from RFC 7999 (confirm that your upstream honors it):

protocol static rtbh {
    ipv4;
    route 203.0.113.10/32 blackhole {
        bgp_community.add((65535, 666));
    };
}

Your detector adds or removes that route through a config include and birdc configure, or through ExaBGP.

Guardrails every automation needs

Common mistakes

Where Nixcon fits

If you operate your own ASN and prefixes, NixMon provides flow-based network monitoring and DDoS detection, so you can apply per-destination thresholds and review traffic without building a collector stack yourself. For mitigation, the DDoS protection and firewall services give you a filtering path to pair with detection. Whatever tooling you use, apply the same principles: measure pps and bps, baseline per host, require persistence, and put guardrails around automation.

Frequently asked questions

What is a good DDoS detection threshold in pps?

There is no universal number. Measure your own traffic for at least two weeks, take the 95th–99th percentile as normal peak, and set the alert at a multiple of that, with a static floor and a hard ceiling based on what your servers and links can handle.

How long does flow-based detection take?

Detection delay is roughly the exporter's active timeout plus the collector's processing interval. With 15–30 second timeouts and a persistence rule of two or three intervals, expect detection within one to two minutes.

Can flow data detect application-layer (L7) attacks?

Only partially. Flow records show IPs, ports, and volumes, not HTTP content. Flow works well for volumetric and protocol attacks. For L7 floods, combine it with web server logs, a WAF, or rate limiting.

Is it safe to fully automate DDoS mitigation?

Yes, if you add guardrails: persistence requirements, scope limits to single hosts or prefixes, automatic expiry, hold-down before release, action rate limits, and a manual kill switch. Start with alert-only mode and enable automation after tuning.

Monitor your prefixes and detect DDoS early with NixMon.Learn more