Router Configuration
flowwler needs two things from each router: flow export towards flowwler and a BGP session that accepts the routes flowwler announces. Juniper (JunOS) and Arista (EOS) are the primary supported platforms, and the examples below lead with them. Cisco IOS-XR and MikroTik RouterOS are documented as additional platforms, with the limits noted in their sections.
| Platform | Flow export | FlowSpec |
|---|---|---|
| Juniper JunOS (primary) | IPFIX with inline-jflow, or IPFIX inline monitoring | Yes |
| Arista EOS (primary) | sFlow v5 | Yes |
| Cisco IOS-XR | NetFlow v9 | Yes |
| MikroTik RouterOS | NetFlow v5 or v9 | No, blackhole only |
Replace 192.0.2.100 with the actual IP of your flowwler server throughout. Set flow timeouts and template refresh intervals explicitly, as the examples do; do not rely on platform defaults.
Flow input comparison
Exporters differ in whether they send packet-length data and how quickly traffic reaches flowwler. Pick a row before configuring a vendor.
| Input | Packet-length data | Detection latency | Sampling rate source |
|---|---|---|---|
| NetFlow v9 / IPFIX, standard templates (Juniper inline-jflow, Cisco IOS-XR) | Only if the template carries fields 25/26 (MIN_PKT_LNGTH/MAX_PKT_LNGTH); the default templates below do not |
Bound by the cache timeout. The Juniper example sets 10s. The Cisco example sets 10s active / 5s inactive | Options Data record (JunOS only); otherwise default_sampling_rate |
| IPFIX inline monitoring (Junos MX/PTX) | Yes | Near real time (no flow cache); aggregation_window of 3-5s is practical. Export volume grows with sampled packets per second |
sampling-rate on the inline-monitoring instance. treat_no_output_as_discard also works if the template carries field 14 (OUTPUT_SNMP); see IPFIX inline monitoring |
| sFlow v5 (Arista EOS) | Exact IP length of each sampled packet | Near real time; polling-interval only affects interface counters |
Per-sample rate, falls back to default_sampling_rate |
NetFlow v5 (MikroTik with version=5) |
No | Bound by the router's flow timeouts (the MikroTik example sets 1m active / 15s inactive) | Taken from the v5 header if set, otherwise default_sampling_rate. The MikroTik example configures no sampling, so leave default_sampling_rate unset |
Packet-length data feeds FlowSpec packet-length matching and source selection; see PktLenRange.
Data for rule match criteria
Rules with tcp_flags, icmp_types/icmp_codes or fragments count only records that carry that data. If the exporter does not send it, the rule stays at 0 and never triggers (see Exporter data requirements).
- sFlow: flags, ICMP and fragment state are read from the sampled packet header, which must be long enough. TCP flags need at least 48 bytes of frame for IPv4 and 68 for IPv6, more with VLAN tags or IPv6 extension headers. A 128-byte sampled header covers the usual cases.
- NetFlow v9 / IPFIX: the template must carry field 6 (
tcpControlBits) fortcp_flagsand field 32 (icmpTypeCodeIPv4) for ICMPv4 criteria. ICMPv6 uses field 139 or fields 176-179. No native field provides fragment state. To see which fields a template carries, enable debug logging and look for the"field_type_ids"log line. - NetFlow v5: TCP flags are always present; ICMPv4 type/code comes from the destination port field. No fragment state.
- Junos inline monitoring: flags, ICMP and fragments are available when
maximum-clip-lengthcovers them (126 in the example below does).
NetFlow and IPFIX report TCP flags as the OR over every packet of a flow, so a record with SYN, ACK and PSH packets also matches tcp_flags: [SYN]. Junos inline monitoring and sFlow report the flags of single packets.
Flow Export
Juniper JunOS
Juniper is a primary platform. Both examples below work; use inline-jflow for a flow-cache setup and inline monitoring for the lowest latency.
Standard IPFIX with inline-jflow
This configuration uses inline-jflow with IPFIX and a named sampling instance, the recommended approach for MX series routers. Sampling runs in hardware on the FPC.
Enable sampling on each transit and peering interface. JunOS needs sampling for both IPv4 and IPv6 in both directions:
set interfaces ge-0/0/0 unit 0 family inet sampling input
set interfaces ge-0/0/0 unit 0 family inet sampling output
set interfaces ge-0/0/0 unit 0 family inet6 sampling input
set interfaces ge-0/0/0 unit 0 family inet6 sampling output
services {
flow-monitoring {
version-ipfix {
template TPL-V4 {
flow-active-timeout 10; /* export active flows every 10 s - fast attack detection */
flow-inactive-timeout 10; /* export idle flows after 10 s */
template-refresh-rate {
packets 1000;
seconds 30;
}
option-refresh-rate { /* re-sends sampling-rate option template */
packets 1000;
seconds 30;
}
ipv4-template; /* built-in template: IP headers + transport headers + sampling rate */
}
template TPL-V6 {
flow-active-timeout 10;
flow-inactive-timeout 10;
template-refresh-rate {
packets 1000;
seconds 30;
}
option-refresh-rate {
packets 1000;
seconds 30;
}
ipv6-template;
}
}
}
}
forwarding-options {
sampling {
instance {
SAMPLING-INSTANCE {
family inet {
input {
rate 1000; /* 1:1000 sampling - adjust to match your traffic volume */
}
output {
flow-server 192.0.2.100 { /* flowwler server IP */
port 2055;
version-ipfix {
template TPL-V4;
}
}
inline-jflow {
source-address 192.0.2.1; /* router loopback - used as the exporter IP in flowwler */
}
}
}
family inet6 {
input {
rate 1000;
}
output {
flow-server 192.0.2.100 {
port 2055;
version-ipfix {
template TPL-V6;
}
}
inline-jflow {
source-address 192.0.2.1;
}
}
}
}
}
}
}
chassis {
fpc 0 { /* repeat for every FPC that handles transit traffic */
pic 0 {
sampling-instance SAMPLING-INSTANCE;
inline-services {
report-zero-oif-gw-on-discard; /* export flows with output ifIndex 0 when the router discards them
required for flowwler's treat_no_output_as_discard and
mitigation effectiveness metrics to work correctly */
flow-table-size {
flex-flow-sizing; /* auto-sizes the flow table based on observed traffic volume */
ipv6-extended-attrib; /* enables full IPv6 5-tuple in the flow cache */
}
}
}
}
}
flowwler config to match:
netflow:
treat_no_output_as_discard: true # relies on report-zero-oif-gw-on-discard above
# default_sampling_rate is not needed - the option template carries the rate automatically
Note:
report-zero-oif-gw-on-discardmakes JunOS export flows for packets it discards. flowwler uses them for the discard metrics and mitigation effectiveness; without it, discarded traffic is invisible.flowwler cannot decode data records until it has the template, so after a flowwler restart detection resumes once the router re-sends it. The 30-second
template-refresh-rateandoption-refresh-rateabove bound that wait; set them explicitly rather than relying on the platform default.
flex-flow-sizingrequires JunOS 15.1F7+. On older versions, remove the line and sizeflow-table-sizemanually.
IPFIX inline monitoring (MX/PTX, aggregation-free)
This alternative ships truncated packet headers inside IPFIX, similar to sFlow. There is no flow cache, so detection can take just a few seconds. Use it on MX and PTX when the lowest latency matters.
Sampling rate and collector are set on the inline-monitoring instance. Traffic is steered into it by firewall filter, not by sampling input/output on the interface.
services {
inline-monitoring {
template INLINE-TPL { /* single template covers both IPv4 and IPv6 */
template-refresh-rate 30;
option-template-refresh-rate 100;
observation-domain-id 1;
}
instance INLINE-INSTANCE {
template-name INLINE-TPL;
maximum-clip-length 126; /* bytes of packet header captured per sample */
collector FLOWWLER {
source-address 192.0.2.1; /* router loopback - used as the exporter IP in flowwler */
destination-address 192.0.2.100; /* flowwler server IP */
destination-port 2055;
sampling-rate 1000; /* 1:1000 - adjust to match your traffic volume */
}
}
}
}
firewall {
family inet {
filter INLINE-FILTER-V4 {
term 1 {
then {
inline-monitoring-instance INLINE-INSTANCE;
accept;
}
}
}
}
family inet6 {
filter INLINE-FILTER-V6 { /* IPv6 requires a separate filter */
term 1 {
then {
inline-monitoring-instance INLINE-INSTANCE;
accept;
}
}
}
}
}
Apply the filters to each transit and peering interface:
set interfaces ge-0/0/0 unit 0 family inet filter input INLINE-FILTER-V4
set interfaces ge-0/0/0 unit 0 family inet filter output INLINE-FILTER-V4
set interfaces ge-0/0/0 unit 0 family inet6 filter input INLINE-FILTER-V6
set interfaces ge-0/0/0 unit 0 family inet6 filter output INLINE-FILTER-V6
No special flowwler config is required; IPFIX frames arrive on the same port (2055).
Note: With no flow cache,
aggregation_windowdrives detection latency. 3-5 seconds is practical.Note:
treat_no_output_as_discardworks with this mode on MX/PTX platforms observed so far, provided the template carries field 14 (OUTPUT_SNMP). Check for"field_type_ids"containing14in the debug logs when a template is first stored, then settreat_no_output_as_discard: trueundernetflow:.
Arista EOS
Arista is a primary platform and exports sFlow v5.
sflow sample 1000
sflow polling-interval 5
sflow destination 192.0.2.100
sflow source-interface Loopback0
sflow run
!
Sampling is active on all interfaces once sflow run is set. To exclude an interface:
interface Ethernet1
no sflow enable
!
Note: Arista EOS exports sFlow, not NetFlow. Set
sflow.enabled: truein the flowwler config (the example config ships it asfalse, and the daemon starts no sFlow listener otherwise), and keep the listener on its default port 6343. Setdefault_sampling_rateto the configured value (e.g.1000); it applies only to samples that report a rate of 0.GET /api/v1/routersshows the rate last reported by the switch.
Validating the sampling rate
flowwler_sflow_counter_validation_ratio{router} compares the bytes estimated from flow samples with the interface octets the switch polled over the same interval. A value near 1 means the sampling rate is right; a value far from 1 points to a wrong rate or a misconfigured sampler. The metric needs both flow and counter samples (keep sflow polling-interval set) and is absent until a counter interval completes. See Troubleshooting.
Cisco IOS-XR
Cisco IOS-XR is an additional documented platform.
flow exporter-map FLOWWLER
destination 192.0.2.100
source Loopback 0
transport udp 2055
version v9
template data timeout 600
!
!
flow monitor-map IPV4-MONITOR
record ipv4
exporter FLOWWLER
cache timeout active 10
cache timeout inactive 5
!
flow monitor-map IPV6-MONITOR
record ipv6
exporter FLOWWLER
cache timeout active 10
cache timeout inactive 5
!
sampler-map SAMPLER-1000
random 1 out-of 1000
!
! Repeat the interface block for all transit/peering interfaces
interface HundredGigE 0/0/0/0
flow ipv4 monitor IPV4-MONITOR sampler SAMPLER-1000 ingress
flow ipv6 monitor IPV6-MONITOR sampler SAMPLER-1000 ingress
!
Note: The cache timeouts are set explicitly on the monitor-maps (10 s active, 5 s inactive); do not rely on the platform defaults (1800 s active, 15 s inactive), which can delay detection (see the flow input comparison). IOS-XR documents that the inactive timeout should be smaller than the active timeout, so the inactive value is 5 s here, not 10 s as in the Juniper example. Only ingress sampling is supported. Replace
HundredGigE 0/0/0/0with your interface type and number. Syntax varies by IOS-XR release and platform, so check it against your release.
MikroTik RouterOS
MikroTik RouterOS is an additional documented platform. The timeouts below are set explicitly; do not rely on the platform defaults.
/ip traffic-flow
set enabled=yes interfaces=all cache-entries=4k active-flow-timeout=1m inactive-flow-timeout=15s
/ip traffic-flow target
add dst-address=192.0.2.100 port=2055 version=9
Note: The example exports NetFlow v9 from all interfaces (
version=9on the target). The configuration has no sampling, so do not setdefault_sampling_rate. Withversion=5there is no packet-length data, and withversion=9only if the template carries fields 25/26 (see the flow input comparison).
BGP
Juniper JunOS
protocols {
bgp {
group FLOWWLER {
type external;
multihop {
ttl 5;
}
import FLOWWLER-IMPORT;
export REJECT;
remove-private;
neighbor 192.0.2.100 {
local-address 192.0.2.1;
family inet {
unicast;
flow;
}
family inet6 {
unicast;
flow;
}
peer-as 65000;
}
}
}
}
policy-options {
policy-statement FLOWWLER-IMPORT {
term BLACKHOLE-V4 {
from {
community BLACKHOLE;
route-filter 0.0.0.0/0 prefix-length-range /32-/32; /* only accept host routes - prevents accidental aggregate blackholing */
}
then {
next-hop discard;
accept;
}
}
term BLACKHOLE-V6 {
from {
community BLACKHOLE;
route-filter ::/0 prefix-length-range /128-/128;
}
then {
next-hop discard;
accept;
}
}
term FLOWSPEC-V4 {
from rib inetflow.0; /* accept all IPv4 FlowSpec rules */
then accept;
}
term FLOWSPEC-V6 {
from rib inet6flow.0; /* accept all IPv6 FlowSpec rules */
then accept;
}
then reject;
}
community BLACKHOLE members 65535:666;
}
Arista EOS
router bgp 65001
neighbor 192.0.2.100 remote-as 65000
neighbor 192.0.2.100 maximum-routes 1000
!
address-family ipv4
neighbor 192.0.2.100 activate
neighbor 192.0.2.100 route-map FLOWWLER-IN in
!
address-family ipv6
neighbor 192.0.2.100 activate
neighbor 192.0.2.100 route-map FLOWWLER-IN-V6 in
!
address-family flow-spec ipv4
neighbor 192.0.2.100 activate
!
address-family flow-spec ipv6
neighbor 192.0.2.100 activate
!
!
ip community-list standard BLACKHOLE permit 65535:666
!
! 192.0.2.254 is your discard next-hop
route-map FLOWWLER-IN permit 10
match community BLACKHOLE
set ip next-hop 192.0.2.254
!
route-map FLOWWLER-IN permit 20
!
! 2001:db8::1 is your IPv6 discard next-hop
route-map FLOWWLER-IN-V6 permit 10
match community BLACKHOLE
set ipv6 next-hop 2001:db8::1
!
route-map FLOWWLER-IN-V6 permit 20
!
Note: The route-maps are applied inbound per address family:
set ip next-hoponly applies to the IPv4 blackhole routes, so IPv6 uses its own route-map withset ipv6 next-hop. Point both next-hops at an address that your switch routes to a discard (null) target. Check this syntax against your EOS release.
Cisco IOS-XR
route-policy PASS-ALL
pass
end-policy
!
route-policy DROP-ALL
drop
end-policy
!
router bgp 65001
address-family ipv4 flowspec
!
address-family ipv6 flowspec
!
neighbor 192.0.2.100
remote-as 65000
address-family ipv4 unicast
route-policy PASS-ALL in
route-policy DROP-ALL out
!
address-family ipv6 unicast
route-policy PASS-ALL in
route-policy DROP-ALL out
!
address-family ipv4 flowspec
route-policy PASS-ALL in
route-policy DROP-ALL out
!
address-family ipv6 flowspec
route-policy PASS-ALL in
route-policy DROP-ALL out
!
!
!
flowspec
address-family ipv4
local-install interface-all
!
address-family ipv6
local-install interface-all
!
!
Note: On IOS-XR an eBGP neighbor without a route-policy accepts and sends no routes, so each address family has an inbound
PASS-ALLand an outboundDROP-ALLpolicy (flowwler does not need routes from the router).PASS-ALLaccepts every route; narrow it if you want to limit what the peer may install. The flowspec address families are enabled globally underrouter bgpbefore they are used on the neighbor. Syntax varies by IOS-XR release and platform, so check it against your release.
MikroTik RouterOS
The snippet below is for RouterOS v7. RouterOS v6 uses a different configuration (/routing bgp peer); this page does not cover it.
/routing bgp connection
add name=flowwler remote.address=192.0.2.100 remote.as=65000 \
local.role=ebgp multihop=yes afi=ip,ipv6 input.filter=flowwler-in
/routing filter community-list
add list=BLACKHOLE communities=65535:666
/routing filter rule
add chain=flowwler-in rule="if (bgp-communities includes-list BLACKHOLE) { set gw 192.0.2.254; accept }"
Note: MikroTik RouterOS has no native FlowSpec support. Only unicast blackhole routes (RTBH) are accepted. FlowSpec mitigations configured in flowwler will not be applied by a MikroTik peer - use
blackholeorsubnet-blackholemitigation types for groups served by MikroTik routers.The filter chain
flowwler-inaccepts routes that carry the blackhole community and sets their next-hop (gw) to192.0.2.254, which should be a discard next-hop on your router (e.g. a blackhole route). RouterOS drops routes that no rule accepts, because the default action of a filter chain isreject. Check this syntax against your RouterOS v7 release: the MikroTik documentation listsblackholeandgwas settable route properties but gives no example of a rule that sets them for RTBH.