---
title: "Flow export from Juniper devices"
description: "Juniper MX (inline-jflow NetFlow v9), ACX7100 on Junos OS Evolved (IPFIX or sFlow) and EX/QFX switches (sFlow) - the commands, the source address rule, sampling and what it does to traffic volumes, and where jFlow does not work."
---

> 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 Juniper devices

This page covers the Juniper 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 device has in NetSense and `<edge port>` is a port that carries the traffic you
want to see. Junos applies nothing until you `commit`.

## Which Juniper models, which protocol

| Model | OS | Use | Traffic volume in NetSense | Status |
| --- | --- | --- | --- | --- |
| MX series, incl. MX204 | Junos OS | NetFlow v9 (inline-jflow), rate 1 | True volume | Not yet verified |
| ACX7100 | Junos OS Evolved | IPFIX (inline-jflow), sampled | About 1/N of the real volume | In production |
| ACX7100 | Junos OS Evolved 22.4R1 and later | sFlow | Estimated real volume | Not yet verified |
| EX2300, EX4600, QFX5120 | Junos OS | sFlow | Estimated real volume | Not yet verified |
| QFX5120 | Junos OS 23.2 | jFlow does not exist on this platform | - | Tested by Extreme Labs |

- Juniper calls its NetFlow and IPFIX export **jFlow**. On MX and ACX it runs in the
  forwarding hardware as **inline-jflow**.
- NetSense does not accept NetFlow v5. Set `version9` or `version-ipfix` explicitly.
- jFlow samples routed (Layer 3) interfaces only. Ports in `ethernet-switching` (Layer 2)
  mode cannot export jFlow: use [sFlow](#ex2300-ex4600-and-qfx5120-junos-os) there.

## MX series, including MX204 (Junos OS)

**Not yet verified.** The vendor's documented configuration. Check it against your release
with `?` help and tell Extreme Labs how it went.

Use inline-jflow with the **version9** template. IPFIX also works on MX, but where a device
offers both, NetSense recommends NetFlow v9.

```txt
set chassis fpc 0 sampling-instance NETSENSE
set services flow-monitoring version9 template NS-V4 ipv4-template
set services flow-monitoring version9 template NS-V4 flow-active-timeout 60
set services flow-monitoring version9 template NS-V4 flow-inactive-timeout 15
set services flow-monitoring version9 template NS-V4 template-refresh-rate seconds 60
set services flow-monitoring version9 template NS-V4 option-refresh-rate seconds 60
set services flow-monitoring version9 template NS-V6 ipv6-template
set services flow-monitoring version9 template NS-V6 flow-active-timeout 60
set services flow-monitoring version9 template NS-V6 flow-inactive-timeout 15
set services flow-monitoring version9 template NS-V6 template-refresh-rate seconds 60
set services flow-monitoring version9 template NS-V6 option-refresh-rate seconds 60
set forwarding-options sampling instance NETSENSE input rate 1
set forwarding-options sampling instance NETSENSE family inet output flow-server <agent-ip> port 2055
set forwarding-options sampling instance NETSENSE family inet output flow-server <agent-ip> version9 template NS-V4
set forwarding-options sampling instance NETSENSE family inet output inline-jflow source-address <device-ip-in-netsense>
set forwarding-options sampling instance NETSENSE family inet6 output flow-server <agent-ip> port 2055
set forwarding-options sampling instance NETSENSE family inet6 output flow-server <agent-ip> version9 template NS-V6
set forwarding-options sampling instance NETSENSE family inet6 output inline-jflow source-address <device-ip-in-netsense>
```

```txt
set interfaces <edge port> unit 0 family inet sampling input
set interfaces <edge port> unit 0 family inet6 sampling input
```

- **Sampling instance:** the instance only works once it is bound to the line card with
  `chassis fpc <slot> sampling-instance`. An MX204 has a single FPC, slot 0. On a chassis MX,
  bind the instance on every FPC that holds an edge port. Each FPC takes one sampling
  instance.
- **Source address:** `inline-jflow source-address` sets the source of the export packets.
  It must be the IP address the router has in NetSense, or the flows arrive without interface
  names. Set it for both families.
- **IPv6:** the `inet6` lines export IPv6 traffic. The `flow-server` stays the IPv4 address of
  the agent: the export itself must travel over IPv4. Drop the `inet6` lines if the port
  carries no IPv6.
- **Rate 1 for true volumes:** `input rate 1` exports every packet. NetSense shows NetFlow
  byte and packet counts as the router sends them and does not multiply them by the sampling
  rate. With `rate 1000`, NetSense shows about 1/1000 of the real traffic: the traffic mix
  stays right, the totals do not. Use the SNMP port graphs for totals in that case.
- **Timeouts:** active 60 s and inactive 15 s keep long sessions updated every minute. The
  Junos default resends the template only every 600 s, so a new export can take ten minutes
  to show anything. `template-refresh-rate seconds 60` shortens that to a minute.
- **Flow table size:** the default inline flow table is small. On a busy router, size it for
  the FPC (`set chassis fpc 0 inline-services ?` shows the options on your release).
  Changing the table size restarts the FPC: do it in a maintenance window.
- **Which ports:** each packet must be counted once. Sample `input` on the border ports
  (upstreams, IX, PNIs, CDN caches) and on the ports toward your customers or BNGs. Never on
  links between your own routers. The alternative is `sampling input` and
  `sampling output` on the border ports only, and nothing else.
- **Sub-interfaces and bundles:** sampling is set per logical unit. Add it to every `unit`
  that carries edge traffic, and on an `ae` bundle to the bundle's unit.
- Do not configure sFlow or egress port mirroring on the same interface as inline-jflow.
- **Check:** `show services accounting flow inline-jflow fpc-slot 0` (the flow counters keep
  increasing) and `show services accounting errors inline-jflow fpc-slot 0`.
- **Remove:** `delete interfaces <edge port> unit 0 family inet sampling`,
  `delete interfaces <edge port> unit 0 family inet6 sampling`,
  `delete forwarding-options sampling instance NETSENSE`,
  `delete services flow-monitoring version9 template NS-V4`,
  `delete services flow-monitoring version9 template NS-V6`,
  `delete chassis fpc 0 sampling-instance`, then `commit`.

## ACX7100 (Junos OS Evolved)

**In production** on ACX7100-32C with Junos OS Evolved, exporting IPFIX through inline-jflow.
The block below is Juniper's documented configuration around that setup: only the
`inline-jflow source-address` line is taken from the production router.

IPFIX through inline-jflow. It works with current NetSense agent versions. The ACX7100 always
samples, so NetSense shows about 1/N of the real volume. For volume estimates, use
[sFlow](#acx7100-with-sflow-junos-os-evolved-224r1-and-later) instead.

```txt
set chassis fpc 0 sampling-instance NETSENSE
set services flow-monitoring version-ipfix template NS-V4 ipv4-template
set services flow-monitoring version-ipfix template NS-V4 template-refresh-rate seconds 60
set services flow-monitoring version-ipfix template NS-V6 ipv6-template
set services flow-monitoring version-ipfix template NS-V6 template-refresh-rate seconds 60
set forwarding-options sampling instance NETSENSE input rate 1000
set forwarding-options sampling instance NETSENSE family inet output flow-server <agent-ip> port 2055
set forwarding-options sampling instance NETSENSE family inet output flow-server <agent-ip> version-ipfix template NS-V4
set forwarding-options sampling instance NETSENSE family inet output inline-jflow source-address <device-ip-in-netsense>
set forwarding-options sampling instance NETSENSE family inet6 output flow-server <agent-ip> port 2055
set forwarding-options sampling instance NETSENSE family inet6 output flow-server <agent-ip> version-ipfix template NS-V6
set forwarding-options sampling instance NETSENSE family inet6 output inline-jflow source-address <device-ip-in-netsense>
set firewall family inet filter NETSENSE-SAMPLE term all then sample
set firewall family inet filter NETSENSE-SAMPLE term all then accept
set firewall family inet6 filter NETSENSE-SAMPLE6 term all then sample
set firewall family inet6 filter NETSENSE-SAMPLE6 term all then accept
```

```txt
set interfaces <edge port> unit 0 family inet filter input NETSENSE-SAMPLE
set interfaces <edge port> unit 0 family inet6 filter input NETSENSE-SAMPLE6
```

- **Source address:** `inline-jflow source-address` must be the address NetSense polls the
  router on. In production that is a private address, not the public address the router
  would otherwise pick. With any other address the flows arrive without interface names.
- **Sampling is forced.** Rate 1000 is an example: the ACX7100 samples in software, so pick a
  rate your traffic level allows. NetSense does not multiply by the rate, so totals are about
  1/N of reality. The traffic mix (peers, protocols, hosts, shares) stays right. Use the
  SNMP port graphs for totals.
- **One packet per record.** Junos OS Evolved exports every sampled packet as its own record.
  Active and inactive timeouts do not apply, and sessions in **Flow Logs** show one packet
  each.
- **Attach with a firewall filter.** On the ACX, sampling is switched on by a filter term with
  `then sample`, applied as an input filter. If the unit already has an input filter, add a
  `then sample` term to that filter instead of replacing it.
- **Which ports:** apply the filter on the border ports and on the ports toward your
  customers or BNGs. Never on links between your own routers.
- **Template interval:** keep `template-refresh-rate seconds 60` so new exports show within a
  minute or two.
- **Check:** `show services accounting flow inline-jflow fpc-slot 0` and
  `show services accounting errors inline-jflow fpc-slot 0`.
- **Remove:** delete the input filters from the edge units, then
  `delete forwarding-options sampling instance NETSENSE`,
  `delete services flow-monitoring version-ipfix template NS-V4`,
  `delete services flow-monitoring version-ipfix template NS-V6`,
  `delete chassis fpc 0 sampling-instance` and the two firewall filters, then `commit`.

### ACX7100 with sFlow (Junos OS Evolved 22.4R1 and later)

**Not yet verified.** The vendor's documented configuration. Check it against your release
with `?` help and tell Extreme Labs how it went.

From Junos OS Evolved 22.4R1 the ACX7100 samples ingress traffic with sFlow. NetSense scales
sFlow samples by the sampling rate, so the volumes estimate the real total. Use the
[EX and QFX statements below](#ex2300-ex4600-and-qfx5120-junos-os) with the same agent address
rule. Egress sFlow on the ACX7100 needs 24.2R1 or later; you do not need it for NetSense.

## EX2300, EX4600 and QFX5120 (Junos OS)

**Not yet verified.** The vendor's documented configuration. Check it against your release
with `?` help and tell Extreme Labs how it went.

sFlow. These switches have no jFlow, or not on Layer 2 ports.

```txt
set protocols sflow agent-id <device-ip-in-netsense>
set protocols sflow source-ip <device-ip-in-netsense>
set protocols sflow collector <agent-ip> udp-port 6343
set protocols sflow sample-rate ingress 2048
set protocols sflow polling-interval 30
```

```txt
set protocols sflow interfaces <edge port>
```

- **Agent address:** NetSense matches sFlow to a device by the agent address inside the
  samples. `agent-id` must be the IP the switch has in NetSense. `source-ip` sets the source
  of the UDP packets: use the same address.
- **Port:** set `udp-port 6343` explicitly. NetFlow's port 2055 does not take sFlow.
- **Sampling:** `sample-rate ingress 2048` samples one inbound packet in 2048. A lower number
  gives more samples and more switch CPU load. NetSense multiplies each sample by the rate, so
  totals are estimates of the real volume. Junos can raise the rate under load; each sample
  carries the rate in use, so the estimate follows.
- **Ingress only:** do not add `sample-rate egress`. Sample the border ports and the ports
  toward your customers or BNGs, never the links between your own switches and routers, so
  each packet is counted once.
- **Polling interval:** the interface counter samples it controls are ignored by NetSense.
  They do no harm.
- **Aggregated Ethernet:** list the physical member ports of an `ae` bundle.
- The management interface (`me0`, `em0`, `vme`) cannot be sampled.
- Junos adds router and gateway data to each sample. NetSense ignores that part and uses the
  sample.
- The same statements exist on other EX and QFX switches.
- sFlow exporters appear in the **Flows** views but not in **Flow Logs** today.
- **Check:** `show sflow`, `show sflow collector` (the sample counter keeps increasing) and
  `show sflow interface`.
- **Remove:** `delete protocols sflow`, then `commit`.

### jFlow on QFX5120

**Tested by Extreme Labs** on QFX5120-32C with Junos OS 23.2.

**Does not work today.** The QFX5120 has no jFlow. The `forwarding-options sampling`
statements commit, but the switch sends no flow records at all. Its in-band flow telemetry
feature cannot export flow records to a collector either. Use
[sFlow](#ex2300-ex4600-and-qfx5120-junos-os).

The same applies to any Juniper port in `ethernet-switching` mode: jFlow samples routed
interfaces (Layer 3 units and IRB) only. Use sFlow on Layer 2 ports.

## When flows do not arrive

Follow [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) on the overview page. On Juniper,
check these first:

- The router is listed under **Unknown** by another IP address: the export leaves from a
  different address. Fix `inline-jflow source-address` (jFlow) or `agent-id` (sFlow).
- Nothing arrives from an MX or ACX: check that `chassis fpc <slot> sampling-instance` is
  set. Without it the sampling instance exports nothing.
- Nothing arrives from a QFX5120 or from Layer 2 ports: jFlow does not run there. Use sFlow.

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