What you'll configure
This guide shows how to configure Flexible NetFlow (FNF) on a Cisco router to export IPFIX, or NetFlow v9, to the EdgeWarden collector. On IOS-XE you build four pieces: flow record, flow exporter, flow monitor and sampler. On IOS-XR the same ideas become maps: flow exporter-map, flow monitor-map and sampler-map.
The focus is on what matters for DDoS detection: ingress and egress interfaces, TCP flags, a sampling rate announced by the router itself, and short timeouts. With factory defaults, a long-lived flow can take 30 minutes to be exported, and the attack shows up when it's already too late.
EdgeWarden supports Cisco through standards: collection via NetFlow v9 or IPFIX, and mitigation via BGP FlowSpec or RTBH. Vendor-specific integrations (PBR, templates and counters) currently exist for Juniper, Huawei and MikroTik. For Cisco IOS and IOS-XR, the vendor-specific feature is the SSH terminal opened from the device record.
Prerequisites
- The EdgeWarden collector reachable from the router. In this example,
192.0.2.10, port 2055/UDP: NetFlow v5, v9 and IPFIX share the same port. - A loopback with a stable IP as the export source. Here,
Loopback0with198.51.100.1. That's the IP you'll register in EdgeWarden. - IOS-XE with
export-protocol ipfix. The "Flexible NetFlow: IPFIX Export Format" feature arrived in IOS XE 3.7S; on platforms or releases without IPFIX, usenetflow-v9, which EdgeWarden collects just the same. - SNMP allowed from the EdgeWarden server to the router, to name interfaces and measure capacity.
- A free slot in the license's exporter quota: Starter 1, Professional 2, Enterprise 10.
Step 1: flow record on IOS-XE
The record defines what is a flow key (match) and what is only counted (collect). For DDoS, key on addresses, protocol, ports, ToS and input interface; collect output interface, TCP flags, minimum TTL, fragmentation fields, 64-bit counters and timestamps. IPv6 needs its own record.
flow record EW-REC-V4
match ipv4 tos
match ipv4 protocol
match ipv4 source address
match ipv4 destination address
match transport source-port
match transport destination-port
match interface input
collect interface output
collect transport tcp flags
collect ipv4 ttl minimum
collect ipv4 fragmentation flags
collect ipv4 fragmentation offset
collect counter bytes long
collect counter packets long
collect timestamp sys-uptime first
collect timestamp sys-uptime last
!
flow record EW-REC-V6
match ipv6 protocol
match ipv6 source address
match ipv6 destination address
match transport source-port
match transport destination-port
match interface input
collect interface output
collect transport tcp flags
collect counter bytes long
collect counter packets long
collect timestamp sys-uptime first
collect timestamp sys-uptime lastIn the IPv4 record, minimum TTL and the fragmentation fields feed the TTL variation (anti-spoofing) and fragment flood detectors. Without them, EdgeWarden warns that those detectors have no data. Not every IOS-XE platform accepts every collect; if a line is rejected, remove just that line.
If you'd rather not build the record, the predefined record netflow ipv4 original-input and record netflow ipv6 original-input in the flow monitor also work, but they don't carry minimum TTL or fragmentation.
Step 2: flow exporter
flow exporter EW-EXP
destination 192.0.2.10
source Loopback0
transport udp 2055
export-protocol ipfix
template data timeout 60
option interface-table timeout 300
option sampler-table timeout 60Three factory defaults need to change here:
transport udp: without it, the exporter uses port 9995, while the collector listens on 2055.export-protocol: the default isnetflow-v9. It works, but IPFIX is the format that gives EdgeWarden more fields.template data timeout: the default is 600 s. Without a template the collector can't decode records, so after a collector restart you could go up to 10 minutes with no data.
option sampler-table sends the sampler table via Options Template. When EdgeWarden matches that table to the flows, the announced rate overrides the manual setting. Still, set the rate in the device record: EdgeWarden applies the announced rate to flows from the same observation domain, and if the sampler table never arrives or comes in a different domain, the device record is what applies. This happens in practice: there are captures from a C8000V running IOS XE 17.18 where the sampler table is sent in a different observation domain from the flows. option interface-table sends the ifIndex-to-interface-name map; EdgeWarden names interfaces through SNMP, so this line is optional.
Step 3: sampler and flow monitor
sampler EW-SAMP
mode random 1 out-of 1000
!
flow monitor EW-MON-V4
record EW-REC-V4
exporter EW-EXP
cache timeout active 60
cache timeout inactive 15
!
flow monitor EW-MON-V6
record EW-REC-V6
exporter EW-EXP
cache timeout active 60
cache timeout inactive 15The default cache timeout active is 1800 s. At 60 s, an ongoing attack is reported every minute; lower values detect faster but increase CPU load and export volume. The 15 s inactive timeout is already the default and is here only to be explicit.
The range for mode random 1 out-of varies by platform: the IOS command reference lists 2 to 32768, and Catalyst switches document smaller ranges. On 10G to 100G edges, 1:1000 is a common starting point.
Step 4: apply to interfaces
interface GigabitEthernet0/0/1
ip flow monitor EW-MON-V4 sampler EW-SAMP input
ipv6 flow monitor EW-MON-V6 sampler EW-SAMP inputApply input on every interface you care about: transit, IX and customers. That way each packet is counted once, on the port where it enters, and you see both the incoming attack and the customer that turns into a reflector.
Step 5: the IOS-XR equivalent
On IOS-XR, the protocol version is a submode of the exporter-map, and the options and template live inside it.
flow exporter-map EW-EXP
version ipfix
template data timeout 60
options interface-table timeout 300
options sampler-table timeout 60
!
transport udp 2055
source Loopback0
destination 192.0.2.10
!
flow monitor-map EW-MON-V4
record ipv4
exporter EW-EXP
cache timeout active 60
cache timeout inactive 15
!
flow monitor-map EW-MON-V6
record ipv6
exporter EW-EXP
cache timeout active 60
cache timeout inactive 15
!
sampler-map EW-SAMP
random 1 out-of 1000
!
interface TenGigE0/0/0/1
flow ipv4 monitor EW-MON-V4 sampler EW-SAMP ingress
flow ipv6 monitor EW-MON-V6 sampler EW-SAMP ingress
!
commitDifferences that matter on IOS-XR:
- Without the
optionscommand, option tables are not exported (timeout 0). With IPFIX on IOS-XR, the sampler option record carries the N of 1 out of N in IE 305, without IE 306; IEs 309 and 310 were only added in releases 7.8.2 and 7.9.1 (defect CSCwe26529). EdgeWarden only derives the rate from IE 305 when IE 306 comes with it, so on IOS-XR the rate isn't detected: the rate in the device record is what applies. - IOS-XR's
record ipv4andrecord ipv6have fixed fields. If EdgeWarden warns that a field is missing, check what your platform's record exports. random 1 out-ofaccepts 1 to 65535, but some platforms (NCS 540 and 560, for example) document specific rates. Check the guide for your platform and release.- On several platforms only the
ingressdirection is supported. - Not every platform and release combination accepts
version ipfix. If the command doesn't exist, useversion v9. - The exporter goes inactive if the source interface has no IP, and Cisco recommends not exporting through the management interface.
Verifying on the router
show flow exporter EW-EXP statistics
Flow Exporter EW-EXP:
Packet send statistics (last cleared 00:05:12 ago):
Successfully sent: 1830 (2213464 bytes)
show flow monitor EW-MON-V4 cache format table
show sampler EW-SAMP
show flow interface GigabitEthernet0/0/1show flow exporter-map EW-EXP
TransportDestPort : 2055
Export Version: IPFIX
show flow exporter EW-EXP location 0/0/CPU0
show flow monitor EW-MON-V4 cache location 0/0/CPU0
show sampler-map EW-SAMPOn IOS-XR, replace 0/0/CPU0 with the node of the line card that hosts the monitored interface.
Verifying in EdgeWarden
- Under Configurações → Rede → Dispositivos (Settings → Network → Devices), register the router with Endereço IP (IP address) set to the address of
Loopback0(198.51.100.1). The screens match the flows' source IP against this field. - Set Taxa de Amostragem de Flow (flow sampling rate) to
1000, the same value as the sampler, even when usingoption sampler-table. When the announced rate is read, the screen shows the detectado (detected) badge; if the manual value differs, you get a warning that it's ignored. The badge shows that the table arrived, not that it was applied to the flows: step 5 is the proof that the multiplication is right. - Configure SNMP in the same record. An interface without an SNMP record is left out of the Interfaces screen.
- Within 1 to 2 minutes flows start showing up. Open the Flows screen and filter by the router.
- Compare one interface's volume with the SNMP counter in the Fluxo × SNMP nas interfaces (Flow × SNMP on interfaces) panel, on the Análise do instante (Instant analysis) screen. If flow shows exactly 1/1000 of SNMP, the rate isn't being applied.
EdgeWarden also reports which fields the router doesn't export and which detector goes blind because of it. If nothing arrives, check on the server:
sudo tcpdump -i any -n udp port 2055 and host 198.51.100.1
sudo journalctl -u flowspec-core -f
sudo ufw allow from 198.51.100.1 to any port 2055 proto udpCommon pitfalls
| Symptom | Likely cause | Fix |
|---|---|---|
| Nothing arrives on 2055 | Exporter default port 9995 | transport udp 2055 |
Interfaces without names (if:12) | Export leaves from an IP other than the registered one | source Loopback0 and the same IP in the device record |
| Volume 1000 times lower than SNMP | Rate not registered, and sampler table missing or not matched to the flows | Rate 1000 in the device record, same as the sampler, plus option sampler-table (XR: options sampler-table) |
| Attack shows up minutes later | Default cache timeout active of 1800 s | cache timeout active 60 |
| Data disappears after a collector restart | Template resent every 600 s | template data timeout 60 |
| IOS-XE refuses to change the monitor's record, or to add or remove the sampler on the interface | Monitor still applied to interfaces | no ip flow monitor (with the same sampler and input) on the interfaces, change, reapply |
| Router vanishes with no error on screen | License exporter quota | Check the plan; excess exporters are dropped before parsing |
Anyone who can reach 2055/UDP can inject forged flows and poison detection. Open the port only to your routers' IPs.
EdgeWarden's analysis cycle is 10 s, and with NetFlow and IPFIX the router's active timeout adds to it. For sub-second bursts, use sFlow or the Packet Sensor.
Next steps
With flows coming in, the next step is tuning thresholds and preparing FlowSpec or RTBH mitigation. If something doesn't show up, follow the flow troubleshooting checklist. To compare with another vendor, see Traffic Flow on MikroTik RouterOS. To bring up the server, use the installation guide, and to understand what each detector looks for, see the attack detection page.