---
title: "Flow export from MikroTik routers"
description: "MikroTik RouterOS 7 and RouterOS 6 (CCR, CHR, x86, RB) Traffic Flow as NetFlow v9 - the commands, the source address, which interfaces to list on a PPPoE BNG, sampling, IPv6, and the traffic that hardware offload hides."
---

> Documentation Index
> Fetch the complete documentation index at: https://netsense-nms.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Flow export from MikroTik routers

This page covers the MikroTik side of flow export. Read the
[overview](https://netsense-nms.com/docs/guides/flow-export/) first: it explains where to send the export
([Before you start](https://netsense-nms.com/docs/guides/flow-export/#before-you-start)), the
[rules for every device](https://netsense-nms.com/docs/guides/flow-export/#rules-for-every-device) and how
[sampling changes the traffic volume](https://netsense-nms.com/docs/guides/flow-export/#sampling-and-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](#hardware-offload-and-fasttrack) |
| Any | Any | sFlow | - | RouterOS has no sFlow export |

- NetSense does not accept NetFlow v1 or v5. Always set `version=9` on 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](#hardware-offload-and-fasttrack) for what switch-chip
  models miss.

## RouterOS 7 (CCR, CHR, x86, RB)

**Tested by Extreme Labs.**

NetFlow v9, unsampled.

```txt
/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-address` must 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](#which-interfaces-to-list) for BNGs.
- **Timeouts:** the default `active-flow-timeout` is 30 minutes, so a long download shows up
  in NetSense only after half an hour, in one lump. `1m` exports long flows every minute.
  `inactive-flow-timeout=15s` is 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. With
  `packet-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=1m` sends 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-entries` is 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-only` gives a
  rough count. On a busy BNG or border router with plenty of memory, larger values are
  available; type `cache-entries=` and press **Tab** to list them.
- **IPv6:** the same `/ip traffic-flow` settings 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-ADDRESS` is the router's IP in NetSense,
  `DST-ADDRESS` is the agent, `PORT` 2055, `VERSION` 9.
- `/ip traffic-flow monitor`: `active-flows` climbs as the router routes traffic, and
  `finished-flows` climbs as flows expire and are exported.
- `/tool sniffer quick ip-address=<agent-ip> port=2055` shows 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:**

```txt
/ip traffic-flow target remove [find dst-address=<agent-ip>]
/ip traffic-flow set enabled=no
```

## RouterOS 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.

```txt
/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=20
```

The bullets under [RouterOS 7](#routeros-7-ccr-chr-x86-rb) 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 `add` rejects `dst-address`, the release uses the older single
  `address=<agent-ip>:2055` field. Type `/ip traffic-flow target add ?` to see which fields
  your release offers.
- **Cache size:** small RB models have little memory. Keep `cache-entries` within what
  `/system resource print` shows as free memory.
- **Check:** `/ip traffic-flow print`, `/ip traffic-flow target print` and the sniffer
  command above. `/ip traffic-flow monitor` is 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 print` shows 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-address` on the target to the router's IP in NetSense.
- **Nothing arrives:** check `version` is `9` (NetSense ignores v5), `port` is `2055`, and
  that the agent is reachable from the router. A firewall rule in the router's `output`
  chain, 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), the
  `interfaces` list, and [hardware offload and FastTrack](#hardware-offload-and-fasttrack).
- **Volumes double the SNMP graph:** two routers export the same traffic, or an internal
  link is in the `interfaces` list of a router that also exports from the border.
- More in the overview: [Check that flows arrive](https://netsense-nms.com/docs/guides/flow-export/#check-that-flows-arrive)
  and [Troubleshooting](https://netsense-nms.com/docs/guides/flow-export/#troubleshooting).

Source: https://netsense-nms.com/docs/guides/flow-export/mikrotik/index.mdx
