This page covers the MikroTik side of flow export. Read the overview first: it explains where to send the export (Before you start), the rules for every device and how sampling changes the traffic volume you see.
In every block, <agent-ip> is your NetSense agent, <device-ip-in-netsense> is the IP
address the router has in NetSense and <edge interfaces> is a comma-separated list of the
interfaces that face your upstreams, IX and peering links and CDN caches.
MikroTik calls its NetFlow export Traffic Flow. It offers NetFlow v1, v5, v9 and IPFIX. Use version 9.
Which MikroTik models, which protocol
| Model | RouterOS | Use | Traffic volume in NetSense | Status |
|---|---|---|---|---|
| CCR, CHR, x86, RB routers | 7.x | NetFlow v9, unsampled | True volume | Tested by Extreme Labs |
| CCR1072-1G-8S+ and other CCR, CHR, x86, RB routers | 6.x | NetFlow v9 (no sampling in RouterOS 6) | True volume | In production on CCR1072-1G-8S+ with RouterOS 6.49.10 |
| CRS3xx and CRS5xx switches, CCR2116, CCR2216 | 7.x | NetFlow v9 for traffic the CPU routes | Hardware-offloaded traffic is missing | See Hardware offload |
| Any | Any | sFlow | - | RouterOS has no sFlow export |
- NetSense does not accept NetFlow v1 or v5. Always set
version=9on the target explicitly, also when you copy an example from elsewhere: many RouterOS guides use v5. - IPFIX (
version=IPFIX) is also accepted by NetSense, but Extreme Labs has tested version 9. Where a device offers both, use NetFlow v9. - Traffic Flow only sees traffic that the router’s CPU handles. CHR and x86 routers, and CCR1000-series routers, route everything in the CPU, so they see all of it. See Hardware offload and FastTrack for what switch-chip models miss.
RouterOS 7 (CCR, CHR, x86, RB)
Tested by Extreme Labs.
NetFlow v9, unsampled.
/ip traffic-flow set enabled=yes interfaces=<edge interfaces> active-flow-timeout=1m inactive-flow-timeout=15s packet-sampling=no cache-entries=256k
/ip traffic-flow target add dst-address=<agent-ip> port=2055 version=9 src-address=<device-ip-in-netsense> v9-template-timeout=1m v9-template-refresh=20- Source address:
src-addressmust be the IP address the router has in NetSense. Left at its default (0.0.0.0), RouterOS uses the address of the interface the export leaves by, and NetSense lists the router under Unknown, without interface names. This was the one fix needed in our test. On an existing target:/ip traffic-flow target set [find dst-address=<agent-ip>] src-address=<device-ip-in-netsense>. - Interfaces: list the edge interfaces only, separated by commas (for example
interfaces=sfp-sfpplus1,sfp-sfpplus2). A packet is recorded when it enters or leaves through a listed interface, so listing your upstreams records both download and upload. The default,all, also records traffic between your own routers and the router’s own traffic. See Which interfaces to list for BNGs. - Timeouts: the default
active-flow-timeoutis 30 minutes, so a long download shows up in NetSense only after half an hour, in one lump.1mexports long flows every minute.inactive-flow-timeout=15sis the default and ends idle flows after 15 seconds. - No sampling:
packet-sampling=no(the default) exports every packet, so NetSense shows the true volume. NetSense does not scale sampled NetFlow. Withpacket-sampling=yes sampling-interval=<A> sampling-space=<B>, RouterOS takes A packets and skips B, and NetSense shows about A/(A+B) of the real traffic. Sample only if the CPU cannot carry unsampled export. - Template: NetSense shows nothing until the router sends its v9 template. By default
RouterOS resent it about every 10 minutes in our test.
v9-template-timeout=1msends it at least every minute, so the first flows appear within a minute or two.v9-template-refresh=20(the default) also resends it every 20 export packets. - Cache size:
cache-entriesis how many flows the router holds at once. The default depends on the router’s memory: 4k on the smallest boards, 256k on larger ones. Size it above the number of concurrent flows:/ip firewall connection print count-onlygives a rough count. On a busy BNG or border router with plenty of memory, larger values are available; typecache-entries=and press Tab to list them. - IPv6: the same
/ip traffic-flowsettings export IPv6 flows with version 9. There is no separate IPv6 menu. The target stays the IPv4 address of the agent: the export itself must travel over IPv4. - Export packet size: NetSense reads export packets of up to 1500 bytes. RouterOS has no setting for the export packet size. If the path from the router to the agent has an MTU above 1500, check the packet length with the sniffer under Check below.
- Clock: set NTP (
/system ntp client) so session times are right.
Check:
/ip traffic-flow print:enabled: yes, your edge interfaces,packet-sampling: no./ip traffic-flow target print:SRC-ADDRESSis the router’s IP in NetSense,DST-ADDRESSis the agent,PORT2055,VERSION9./ip traffic-flow monitor:active-flowsclimbs as the router routes traffic, andfinished-flowsclimbs as flows expire and are exported./tool sniffer quick ip-address=<agent-ip> port=2055shows the export packets leaving the router, with their source address and size. Stop it with Ctrl-C after a few seconds: the sniffer adds CPU load on a busy router.
Remove:
/ip traffic-flow target remove [find dst-address=<agent-ip>]
/ip traffic-flow set enabled=noRouterOS 6 (CCR, CHR, x86, RB)
In production on CCR1072-1G-8S+ with RouterOS 6.49.10.
NetFlow v9. RouterOS 6 has no packet sampling: it always exports every packet.
/ip traffic-flow set enabled=yes interfaces=<edge interfaces> active-flow-timeout=1m inactive-flow-timeout=15s cache-entries=256k
/ip traffic-flow target add dst-address=<agent-ip> port=2055 version=9 src-address=<device-ip-in-netsense> v9-template-timeout=1m v9-template-refresh=20The bullets under RouterOS 7 apply. The differences:
- No
packet-sampling: leave it out. Packet sampling exists only in RouterOS 7, so the RouterOS 6 export is always unsampled and NetSense shows the true volume. - Menu syntax: RouterOS 6 uses the space form (
/ip traffic-flow target). RouterOS 7 accepts both the space form and the slash form (/ip/traffic-flow/target). The commands on this page use the space form, so they work on both. - Target fields: if
addrejectsdst-address, the release uses the older singleaddress=<agent-ip>:2055field. Type/ip traffic-flow target add ?to see which fields your release offers. - Cache size: small RB models have little memory. Keep
cache-entrieswithin what/system resource printshows as free memory. - Check:
/ip traffic-flow print,/ip traffic-flow target printand the sniffer command above./ip traffic-flow monitoris documented for RouterOS 7. - Remove: the same two commands as RouterOS 7.
Which interfaces to list
NetSense does not remove duplicates. Every packet must be exported once, by one router.
- Border router: list the upstream, IX, PNI and CDN cache interfaces. Leave out the links to your own routers and BNGs.
- PPPoE BNG: list the upstream interfaces of the BNG, the ones toward your core or border. Every subscriber packet to or from the internet crosses one of them, so each one is recorded once, in both directions.
- Never list the dynamic PPPoE interfaces (
<pppoe-...>). RouterOS creates one per session and removes it when the session ends, so a fixed interface list cannot follow them, and you do not need them: the upstream interfaces already carry all subscriber traffic to the internet. - One exporter per path: if the BNG sits behind a border router that already exports the same traffic, export from one of them, not both. Exporting from the BNG shows the subscriber addresses. Exporting from the border shows the whole network in one place.
- Which name to list: list the interface that holds the IP address toward the upstream,
as
/ip address printshows it: a VLAN, bonding or bridge interface if that is where the address sits. - Subscriber addresses: Traffic Flow records packets before source NAT. On a NAT or CGNAT BNG the flows show each subscriber’s own (private or CGNAT) address, not the public address it is translated to.
Hardware offload and FastTrack
Traffic Flow only counts what the router’s CPU processes. What MikroTik documents:
- L3 hardware offloading (L3HW): on models that route in the switch chip (CRS3xx and CRS5xx switches, CCR2116, CCR2216), MikroTik states that L3HW-offloaded traffic is not reported through Traffic Flow. Offloaded FastTrack connections on these models are handled by the switch chip too, so they are not counted either. To export that traffic, keep L3HW off on the ports involved or suppress offload for the routes you need (see MikroTik’s L3 Hardware Offloading guide), at the cost of routing it in the CPU, or export from another router on the path.
- Bridged traffic in the switch chip: traffic bridged between switch-chip ports with hardware offload never reaches the CPU, so it never appears in Traffic Flow.
- Mirror ports: a router cannot count traffic mirrored to it from a switch port. MikroTik drops mirrored frames before Traffic Flow sees them.
- Firewall drops: a packet that the firewall drops in the raw or filter rules before the Traffic Flow step is not counted.
- FastTrack (software): MikroTik’s documentation is not consistent. The current packet flow page lists Traffic Flow among the features that FastTrack packets bypass. The older RouterOS 6 FastTrack page says this restriction was removed in RouterOS 6.33. Extreme Labs has not tested it. If you use FastTrack, compare the Flows totals with the SNMP traffic graph of the upstream port: with unsampled export they should be close.
CHR, x86 and CCR1000-series routers have no L3 offload, so all routed traffic passes the CPU
and Traffic Flow sees it. The cost is CPU load: watch /system resource monitor after you
enable unsampled export on a busy router.
Troubleshooting
- Router under Unknown, by an IP address: the export leaves from another address. Set
src-addresson the target to the router’s IP in NetSense. - Nothing arrives: check
versionis9(NetSense ignores v5),portis2055, and that the agent is reachable from the router. A firewall rule in the router’soutputchain, or any firewall between the router and the agent, can drop the export. The sniffer command under Check shows whether packets leave the router. - First flows take long: the template has not been sent yet. Set
v9-template-timeout=1m. - Volumes far below the SNMP graph: check
packet-sampling(RouterOS 7), theinterfaceslist, and hardware offload and FastTrack. - Volumes double the SNMP graph: two routers export the same traffic, or an internal
link is in the
interfaceslist of a router that also exports from the border. - More in the overview: Check that flows arrive and Troubleshooting.