What you'll tune
Three exporter settings decide whether an attack shows up in EdgeWarden within seconds, half an hour later, or never:
- Sampling rate: at 1:N, the router takes 1 out of every N packets and skips the other N−1. It sets the smallest attack you can see.
- Active and inactive timeout: how long a flow sits in the router cache before it is exported. It sets detection latency.
- Template and options refresh: how often the router resends the template and the sampling rate. It sets how long the numbers stay wrong after a restart.
Prerequisites
- A router already exporting NetFlow v9 or IPFIX to the collector at
192.0.2.10, port 2055/UDP, from a fixed IP (in this example, the loopback198.51.100.1). - The router registered under Configurações → Rede → Dispositivos (Settings → Network → Devices) with that IP and with SNMP, so you can compare flow volume against the interface counter.
- A maintenance window: changing the sampling rate shifts every graph for that exporter.
How EdgeWarden compensates for sampling
The collector multiplies bytes and packets by the rate before storing them; the screens never multiply again. A single flow sampled at 1:1000 shows up on the Flows screen already multiplied by 1000. The rate comes from one of three sources:
- Announced by the router: NetFlow v9 and IPFIX can send the rate in an Options Template (EdgeWarden reads fields 34, 50, 305, and 306). When present, this value always wins. If the router announces different rates per interface and direction, each flow gets the rate of its own interface.
- Entered manually: the device's Taxa de Amostragem de Flow (flow sampling rate) field (
1000= 1:1000). It applies when the router doesn't announce a rate, it is a single value per exporter, and it reloads without restarting the service. - Embedded in sFlow: each sample carries its own rate.
With NetFlow v5, EdgeWarden does not apply the rate automatically. Without the manual entry, a router at 1:1000 shows one thousandth of the real traffic and every threshold becomes meaningless.
Step 1: choose the sampling rate
With 1:N sampling, traffic of P packets per second produces about P/N samples per second. The relative error of the estimate is roughly 1/√n, where n is the number of samples in the window. With the default 10-second analysis cycle:
| Traffic toward the target | Samples per cycle at 1:100 | Samples per cycle at 1:1000 |
|---|---|---|
| 1,000 pps | 100 (~10% error) | 10 (~32% error) |
| 10,000 pps | 1,000 (~3% error) | 100 (~10% error) |
| 100,000 pps | 10,000 (~1% error) | 1,000 (~3% error) |
A rule of thumb: to get at least 100 samples per cycle, keep N at or below one tenth of the smallest attack, in pps, that you need to see. To catch 10,000 pps, 1:1000 is enough; for 1,000 pps, you need 1:100 or lower.
Small flows suffer the most. A destination that receives k packets, with k much smaller than N, has roughly a k/N chance of showing up: at 1:1000, a host that receives 50 packets from a scan shows up about one time in 20. That's why carpet bombing, with little traffic per IP, should be handled with block rules (Subnet/Bloco), which sum the whole prefix.
The cost lands on the exporter: a smaller N (denser sampling) means more cache entries, more export packets, and more CPU, especially when flow accounting runs in software. Platforms with hardware flow accounting have their own export limits; check the one for your model. Suggested starting values, assuming an average packet size of 1,000 bytes:
| Router peak traffic | Starting rate | Samples/s at peak | Smallest attack with ~100 samples per cycle |
|---|---|---|---|
| up to 1 Gbps | 1:100 | ~1,250 | 1,000 pps |
| 1 to 10 Gbps | 1:500 | ~2,500 | 5,000 pps |
| 10 to 100 Gbps | 1:1000 | ~12,500 | 10,000 pps |
| above 100 Gbps | 1:2000 to 1:4000 | ~3,000 to 6,000 per 100 Gbps | 20,000 to 40,000 pps |
The accepted range varies by platform: Junos 1 to 16,000,000 (the MX150 warns below 1000), IOS-XE 2 to 32768 in the general reference, IOS-XR 1 to 65535, and VRP 1 to 65535. Some models accept only part of it.
Step 2: tune the active and inactive timeouts
The active timeout exports long-lived flows at fixed intervals. The inactive timeout exports flows that stopped receiving packets. Both matter for detection:
- An attack with a stable 5-tuple, such as a flood from a few fixed sources, is only reported when the active timeout expires.
- An attack with spoofed sources and ports creates a new flow for every sampled packet. Those flows carry a single packet and leave through the inactive timeout.
Worst-case latency is the active timeout plus one analysis cycle (10 s by default, configurable down to 1 s). Several vendors default to 30 minutes, which makes detection useless. Use 60 s active and 15 s inactive; drop active to 30 s if the router CPU allows. Below that the gain is small and the load grows. To react in under 1 second, use sFlow or the Packet Sensor.
| Platform | Active (default) | Inactive (default) | Range |
|---|---|---|---|
| Junos (inline J-Flow, IPFIX template) | 60 s | 60 s | 10 to 600 s |
| IOS-XE (Flexible NetFlow) | 1800 s | 15 s | 1 to 604800 s |
| IOS-XR | 1800 s | 15 s | platform dependent |
| VRP (NE40E/NE8000) | 30 min on several releases | release dependent | active in minutes or, on recent releases, in seconds |
| RouterOS v7 | 30m | 15s | no published range |
Step 3: resend templates and the rate often
NetFlow v9 and IPFIX over UDP need the template to decode records. After a collector or router restart, records that arrive before the template are lost, and flows that arrive before the options template have no announced rate. During that gap EdgeWarden uses the manually entered value; without one, traffic shows up divided by the rate and the carpet bomb detector holds off learning its baseline for up to 30 minutes.
The defaults are long: 600 s on IOS-XE and Junos, 1800 s on IOS-XR. Use 60 s. The blocks below show only the settings covered here, on top of the configuration from each vendor guide.
set forwarding-options sampling instance ew-sampling input rate 1000
set services flow-monitoring version-ipfix template ew-ipv4 flow-active-timeout 60
set services flow-monitoring version-ipfix template ew-ipv4 flow-inactive-timeout 15
set services flow-monitoring version-ipfix template ew-ipv4 template-refresh-rate seconds 60
set services flow-monitoring version-ipfix template ew-ipv4 option-refresh-rate seconds 60Repeat the template lines for ew-ipv6. Junos options data includes the sampling interval (field 34).
sampler EW-SAMP
mode random 1 out-of 1000
!
flow monitor EW-MON-V4
cache timeout active 60
cache timeout inactive 15
!
flow exporter EW-EXP
template data timeout 60
option sampler-table timeout 60sampler-map EW-SAMP
random 1 out-of 1000
!
flow monitor-map EW-MON-V4
cache timeout active 60
cache timeout inactive 15
!
flow exporter-map EW-EXP
version ipfix
template data timeout 60
options sampler-table timeout 60
!
!
commitOn both Cisco platforms, repeat the timeouts on EW-MON-V6.
ip netstream sampler fix-packets 1000 inbound
ip netstream sampler fix-packets 1000 outbound
ip netstream timeout active interval-second 60
ip netstream timeout inactive 15
ip netstream export template timeout-rate 1
ip netstream export template option sampler
ip netstream export template option timeout-rate 1
commitOn VRP, interval-second exists on recent NE8000 and NE40E releases; on older releases the active timeout is in minutes (ip netstream timeout active 1). Both timeout-rate values are in minutes. Repeat with ipv6 netstream for IPv6.
# 1 packet sampled, 999 skipped
/ip traffic-flow set packet-sampling=yes sampling-interval=1 sampling-space=999 active-flow-timeout=1m inactive-flow-timeout=15sRouterOS resends the template every 20 packets by default (v9-template-refresh, under /ip traffic-flow target), but its documentation doesn't describe announcing the rate: on MikroTik, the manual entry is mandatory.
Step 4: enter the rate in EdgeWarden
Under Configurações → Rede → Dispositivos, edit the router and set Taxa de Amostragem de Flow to the same N as the router (1000 for 1:1000; 1 for unsampled). Do this even when the router announces the rate: the announced value still wins, and the manual entry covers the gap after a restart until the options template arrives.
The screen shows a detectado (detected; announced rate, v9 and IPFIX only) or manual badge. If the announced value differs from the entry, you'll see the warning cadastro: 1:N (ignorado) (entry ignored).
Changed the rate on the router? Change the entry in the same window. On exporters that don't announce the rate, the old entry multiplies by the wrong value and every threshold for that router becomes meaningless.
Verifying on the router
| Platform | Command | What to check |
|---|---|---|
| Junos | show services accounting flow inline-jflow fpc-slot 0 | Flows Active Timed Out and Flows Inactive Timed Out increasing |
| IOS-XE | show flow monitor EW-MON-V4 and show sampler EW-SAMP | Active and inactive timeout; sampler rate |
| IOS-XR | show flow monitor-map EW-MON-V4 and show sampler-map EW-SAMP | Timeouts; Random (1 out of 1000 Pkts) |
| VRP | display netstream global | Global NetStream settings |
| RouterOS | /ip traffic-flow print | packet-sampling, sampling-space, and timeouts |
Verifying on EdgeWarden
sudo tcpdump -i any -n -c 5 udp port 2055 and host 198.51.100.1
10:15:02.481233 ens18 In IP 198.51.100.1.50123 > 192.0.2.10.2055: UDP, length 1380
sudo journalctl -u flowspec-core -fThen, in the web interface (labels are in Portuguese):
- Under Configurações → Rede → Dispositivos, check for the detectado or manual badge and make sure there is no ignored-entry warning.
- Within 1 to 2 minutes, flows show up on the Flows screen, already multiplied by the rate.
- On the Análise do instante screen, the Fluxo × SNMP nas interfaces (flow vs. SNMP) panel compares flow volume against the SNMP counter. If the flow shows 1/N of SNMP, the rate is missing; if it shows N times, it was applied twice.
Common pitfalls
- The 30-minute default timeout. It's the most common cause of "the attack only showed up after it ended."
- Different rates per direction. Some routers sample ingress and egress on the same port at different rates. If the rate is announced per interface, EdgeWarden applies each one; with the manual entry, no single value fits both. Validate against SNMP and treat the mismatched direction as an estimate.
- Options template turned off. On VRP, without
ip netstream export template option samplerthe router doesn't announce the rate; on Cisco, the same goes foroption sampler-table. - Sampling too dense. With a small N, the exporter saturates before the collector does: full cache, export errors, high CPU. Reduce N in steps while watching the CPU. On the server, check for drops with
nstat -az | grep -iE "Udp.*(InErrors|RcvbufErrors)". - Small attacks going unseen. If you need to see attacks below what the rate allows, use the Packet Sensor instead of pushing the router to its limit.
Next steps
To pick the protocol before tuning the numbers, read NetFlow, IPFIX, or sFlow: which one to choose. The full per-vendor configuration is in the guides for Juniper MX, Huawei NE40E/NE8000, Cisco IOS-XE and IOS-XR, and MikroTik RouterOS v7. If flows don't show up, follow the step-by-step troubleshooting. See Features for how EdgeWarden uses these flows to detect and mitigate attacks.