Skip to content

Flow export from Huawei devices

NetStream (NetFlow v9) and sFlow commands for Huawei S-series switches, CloudEngine switches, NetEngine routers and AR routers - which model supports which protocol, the two command families, interface numbering, sampling and how to check and remove the configuration.

Huawei calls NetFlow NetStream. NetSense accepts it as NetFlow version 9 on UDP 2055, and sFlow version 5 on UDP 6343. This page gives the commands per Huawei family. Read Before you start and Rules for every device on the overview first: they apply to every block below.

In the commands, <agent-ip> is the IP address of your NetSense agent, <device-ip-in-netsense> is the IP address the device has in NetSense, and <edge port> is a border port (upstream, IX, PNI, peering or CDN cache).

Which Huawei models, which protocol

Family Models NetStream sFlow Use Section
S-series with NetStream S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6730-H, S6730S-H, S6730-S, S6730S-S. Older: S5720-HI, S6720-HI Yes Yes on the current models NetStream for the traffic mix, or sFlow for volume estimates NetStream, sFlow
S-series, sFlow only S6720-EI, S5720-EI, S5720-SI, S6720-SI, S6720-LI, S5735-S, S5735-L and the other S5700 and S6700 models No Yes, except S5731-L, S5731S-L and S5751-L sFlow sFlow
Chassis switches S7700, S9700, S12700 Depends on the line card Not verified Check with ? help Chassis switches
CloudEngine CE5800, CE6800, CE7800, CE8800 Yes, from a minimum release per model Yes NetStream or sFlow, never both on one device CloudEngine
NetEngine routers NE8000, NE40E, NE20E, NE05E, ATN Yes Yes NetStream NetEngine
AR routers AR600 and AR6000 (V300), AR100 to AR3600 (V200), AR5700, AR6700, AR8000 (V600) Yes Not verified NetStream AR routers

Not sure what your switch supports? Type ip netstream ? in system view. If the command is rejected, the model has no NetStream: use sFlow.

S-series switches: NetStream (VRP V200R021 to V200R025)

Tested by Extreme Labs on S6730-H with VRP V200R024. In production on S6730S-H with VRP V200R021.

NetStream exports NetFlow version 9 from the models in the first row of the table above. Configure the global part once, then each border port:

system-view
ip netstream export version 9 origin-as
ip netstream export source <device-ip-in-netsense>
ipv6 netstream export source <device-ip-in-netsense>
ip netstream export host <agent-ip> 2055
ip netstream export index-switch 32
ip netstream export template timeout-rate 1
ip netstream timeout active 1
ip netstream timeout inactive 15
interface <edge port>
 ip netstream inbound
 ip netstream outbound
 ip netstream sampler fix-packets 1200 inbound
 ip netstream sampler fix-packets 1200 outbound
 ipv6 netstream inbound
 ipv6 netstream outbound
 ipv6 netstream sampler fix-packets 1200 inbound
 ipv6 netstream sampler fix-packets 1200 outbound
 quit
return
save

Repeat the interface block for every border port. Drop the ipv6 lines on a port without IPv6 traffic.

  • index-switch 32 is required. By default the switch exports its own 16-bit interface index, not the SNMP interface number. Flows then land on the wrong port, or on a port without a name. We saw this on production switches. With 32 the switch exports the SNMP interface number. It works with version 9 only.
  • Export source. export source must be the IP address the switch has in NetSense, for IPv4 and IPv6 flows alike. The export leaves through a service port: the out-of-band management port (MEth) cannot send it.
  • Template. The default template interval is 30 minutes, so a new exporter can show nothing for half an hour. template timeout-rate 1 resends it every minute. refresh netstream template in user view resends it at once.
  • Timeouts. timeout inactive 15 closes idle flows after 15 seconds. timeout active 1 is the value we run: long flows are exported about every minute. Check the unit with ip netstream timeout active ? on your release.
  • These switches always sample. With no sampler set, a port samples 1 packet in 1000 (Huawei documentation, and it matches what we measured). S-series NetStream volumes are therefore always sampled: with the block above NetSense shows 1/1200 of the real traffic or less. Use the Flows views for the traffic mix and the port graphs for totals, see Sampling and traffic volume.
  • Same sampler on every port, for IPv4 and IPv6. The only sampler keyword is fix-packets: random-packets is rejected.
  • Eth-Trunk and Vlanif reject ip netstream. Configure the member ports of the trunk. Flows then show per member port. If the switch routes on Vlanif interfaces, configure the physical border ports that carry them.
  • Border ports only, both directions, as in the rules for every device. Never enable NetStream on a link to your own routers or switches: the same traffic then shows twice.
  • At most two export hosts. If the switch already exports to two collectors, remove one before you add NetSense.
  • origin-as adds the source and destination AS numbers to each record.
  • If IPv6 flows do not arrive, add ipv6 netstream export host <agent-ip> 2055 too: Huawei documents a separate IPv6 destination.
  • Do not use the netstream export ip ... commands: that is the CloudEngine family, and these switches reject it.

Check: display current-configuration | include ^interface|netstream lists the ports that carry NetStream. In display ip netstream statistics slot 0 the exported packet count keeps growing. display netstream all shows the whole configuration.

Remove: on each port

interface <edge port>
 undo ip netstream inbound
 undo ip netstream outbound
 undo ipv6 netstream inbound
 undo ipv6 netstream outbound
 quit

then undo ip netstream export host <agent-ip> 2055 in system view. An undo line on a port without NetStream prints an error: you can ignore it.

S-series switches: sFlow

Tested by Extreme Labs on S6730-H with VRP V200R024. In production on S6720-54C-EI with VRP V200R022.

sFlow is the choice on every S-series model without NetStream. On the models with NetStream it is the alternative when you want volume estimates, see Sampling and traffic volume.

system-view
sflow agent ip <device-ip-in-netsense>
sflow collector 1 ip <agent-ip> port 6343 description NetSense
interface <edge port>
 sflow flow-sampling collector 1
 sflow flow-sampling rate 1024
 quit
return
save
  • sFlow is off until you enable it per port. The global commands only set the agent address and the destination. There is no switch to sample every port.
  • sflow agent ip must be the IP the switch has in NetSense: NetSense matches the samples to the switch by it. There is no separate source command.
  • The keyword is port, not udp-port.
  • An Eth-Trunk or Vlanif rejects sflow: configure the physical member ports.
  • The rate is one packet in N, from 256 to 1048576 (default 2048). 1024 suits 10G border ports. A lower N means more samples and more load on the switch CPU.
  • Huawei advises at most eight sampling interfaces per switch to keep sampling accurate.
  • sFlow volumes are scaled: NetSense multiplies each sample by the rate, so the totals in the Flows views estimate the real traffic. sFlow exporters appear in the Flows views but not in Flow Logs today.
  • Follow the inbound pattern of the rules for every device: inbound on the border ports and on the ports toward your customers or BNGs, never on links between your own devices. To sample inbound only, add sflow flow-sampling inbound on each port (Huawei documents it; the default is both directions).
  • At most two collectors.

NetStream or sFlow on the -H and -S models? These models offer both. Use NetStream when you want the traffic mix with sessions in Flow Logs, and sFlow when you want volume estimates in the Flows views. Pick one per port, never both: NetSense would count the same packets twice.

Check: display sflow lists the ports that sample. In display sflow statistics the Flow-sample sequence keeps increasing.

Remove: undo sflow flow-sampling rate on each port, then undo sflow collector 1 (this also clears the per-port collector setting) and undo sflow agent ip <device-ip-in-netsense>.

Chassis switches (S7700, S9700, S12700)

Not yet verified. On these switches NetStream depends on the line card: older Huawei documentation limits it to enhanced cards with fixed-packet sampling. Type ip netstream ? and sflow ? in system view to see what your cards offer, and tell Extreme Labs how it went. Where the commands are accepted, they follow the S-series blocks above.

CloudEngine switches (VRP8)

Not yet verified. The vendor’s documented configuration for CE5800, CE6800, CE7800 and CE8800 on V200R019C10. CloudEngine CE8851 is among the switches NetSense customers run. Check the commands against your release with ? help and tell Extreme Labs how it went.

A CloudEngine switch runs NetStream or sFlow, never both: Huawei does not allow the two on one device. CloudEngine NetStream always samples, so choose by what you need: NetStream for sessions in Flow Logs and the traffic mix, sFlow for volume estimates.

NetStream

system-view
netstream sampler random-packets 1024 inbound
netstream sampler random-packets 1024 outbound
netstream export ip version 9
netstream export ip index-switch 32
netstream export ip source <device-ip-in-netsense>
netstream export ip host <agent-ip> 2055
netstream timeout ip active 1
netstream timeout ip inactive 15
commit
interface <edge port>
 netstream inbound ip
 netstream outbound ip
 commit
 quit
  • netstream export ip source is mandatory. Without a source address the switch exports nothing and shows no error.
  • index-switch 32 makes the switch export the SNMP interface number instead of its own 16-bit index. It needs version 9.
  • Set the sampler. None is configured by default. CloudEngine only offers random-packets. Use a power of two: Huawei recommends 1024 on chip-mode models and at least 2048 when a whole switch samples in enhanced mode. NetSense shows about 1/N of the real traffic, see Sampling and traffic volume.
  • Timeouts. The defaults are 30 minutes active and 30 seconds inactive. The block sets 1 minute and 15 seconds. The template is resent every minute by default on V200R002C50 and later.
  • Sampling mode. On the standard (CPU) mode the whole switch handles about 3,000 to 5,000 samples per second, and only 1,000 when its CPU is above 65%: busy ports then get a lower effective rate. CE8868EI, CE8861EI, CE8850-64CQ-EI, CE6875EI, CE6865EI and CE6857EI have an enhanced mode (assign forward enp netstream enable slot <n>, then a reboot). CE6880EI, CE6881, CE6820, CE6863 and CE5880EI sample in the chip only.
  • In enhanced and chip mode the export cannot leave through the management interface: the source address must be reachable through a service port.
  • Eth-Trunk is accepted. Configure the trunk or its members, not both.
  • Sub-interfaces are sampled on the main interface, and their traffic is reported under the main interface.
  • At most two export hosts. CE6810LI exports Layer 2 flow statistics only.
  • For IPv6 flows the matching ipv6 commands exist (netstream inbound ipv6). Check them with netstream ? on your release.

Check: display netstream all, display netstream export ip template and display netstream statistics ip slot 1.

Remove: undo netstream inbound ip and undo netstream outbound ip on each port, then undo netstream export ip host <agent-ip> 2055 in system view, then commit.

sFlow

system-view
sflow agent ip <device-ip-in-netsense>
sflow source ip <device-ip-in-netsense>
sflow collector 1 ip <agent-ip> udp-port 6343
commit
interface <edge port>
 sflow sampling collector 1
 sflow sampling rate 1024
 sflow sampling inbound
 commit
 quit
  • CloudEngine uses sflow sampling on the port, not the S-series sflow flow-sampling, and udp-port, not port.
  • Set both addresses: sflow agent ip is the address inside the sFlow data, which NetSense matches to the switch. sflow source ip is the source of the packets.
  • The port must name a collector and a direction, or sampling does not start.
  • sFlow volumes are scaled by the rate and estimate the real traffic. sFlow exporters do not appear in Flow Logs today.
  • sFlow cannot sample MPLS-encapsulated or VPLS traffic. At most two collectors.

Check: display sflow configuration all.

Remove: undo sflow sampling collector 1 on each port, then undo sflow collector 1, then commit.

NetEngine routers (VRP8)

In production on NetEngine 8000 M1A with VRP8: NetStream version 9, sampling 1 in 1024, active timeout 1 minute, inactive 15 seconds, export on Eth-Trunk and physical ports.

Not yet verified on NE40E, NE20E, NE05E and ATN. Huawei documents the same NetStream commands for them: check against your release with ? help and tell Extreme Labs how it went.

system-view
ip netstream export version 9
ip netstream export index-switch 32
ip netstream export source <device-ip-in-netsense>
ip netstream export host <agent-ip> 2055
ip netstream export template timeout-rate 1
ip netstream timeout active 1
ip netstream timeout inactive 15
ip netstream sampler fix-packets 1024 inbound
ip netstream sampler fix-packets 1024 outbound
slot <slot-id>
 ip netstream sampler to slot self
 quit
commit
interface <edge port>
 ip netstream inbound
 ip netstream outbound
 commit
 quit
  • Sampler. Set globally, as above, it applies to every port. A sampler set on a port overrides it. The keywords are fix-packets, random-packets and fix-time. NetSense shows about 1/1024 of the real traffic, see Sampling and traffic volume. Some older NE40E hardware rounds the rate to a power of two, so use 1024 rather than 1000.
  • Slots. Repeat the slot block for every slot that holds a border port (display device lists the slots). If a board cannot process samples itself, Huawei lets you point it at another board with ip netstream sampler to slot <slot-id>.
  • index-switch 32 makes the router export the SNMP interface number instead of its own 16-bit index.
  • Eth-Trunk is accepted: configure the trunk itself.
  • The export leaves through a service interface, not the management interface.
  • Use version 9. These routers also offer IPFIX: NetSense accepts it, but version 9 is the configuration in production.
  • IPv6. Add the same lines with ipv6 netstream: version 9, index-switch 32, source, host, sampler, sampler to slot self and ipv6 netstream inbound and outbound on the port.

Sub-interfaces (VLANs)

NetStream on a main interface does not cover its sub-interfaces. Enable it on the parent and on each sub-interface that carries border traffic. On the sub-interface also add set flow-stat interval 30 and statistic enable, which turn on its traffic statistics. This is the configuration Extreme Labs uses for VLAN sub-interfaces on NetEngine routers:

interface <edge port>
 ip netstream inbound
 ip netstream outbound
 quit
interface <edge port>.<vlan-id>
 ip netstream inbound
 ip netstream outbound
 set flow-stat interval 30
 statistic enable
 quit
commit

The parent and the sub-interface record different traffic, so this does not count anything twice.

sFlow on NetEngine

NetEngine routers also support sFlow, flow sampling only. NetStream and sFlow are mutually exclusive on these routers: use NetStream.

Check: display netstream all, display ip netstream statistics slot <slot-id> and display ip netstream statistics interface <edge port>.

Remove: undo ip netstream inbound and undo ip netstream outbound on each port, then undo ip netstream export host <agent-ip> 2055 in system view, then commit.

AR routers

Not yet verified. The vendor’s documented configuration for AR600 and AR6000 on V300R023. Check it against your release with ? help and tell Extreme Labs how it went.

AR600, AR6000 and the older AR100 to AR3600 (V200R009) use the ip netstream family:

system-view
ip netstream export version 9
ip netstream export index-switch 32
ip netstream export source <device-ip-in-netsense>
ip netstream export host <agent-ip> 2055
interface <edge port>
 ip netstream sampler fix-packets 1024 inbound
 ip netstream sampler fix-packets 1024 outbound
 ip netstream inbound
 ip netstream outbound
 quit
return
save
  • With no sampler set, these routers sample 1 packet in 100. Set the sampler explicitly and use the same value on every port. NetSense shows about 1/N of the real traffic.
  • index-switch 32 exports the SNMP interface number and needs version 9.
  • At most two export hosts.

The NetEngine AR5700, AR6700 and AR8000 on V600 use the CloudEngine family (netstream export ip host, netstream export ip source) and need commit. Follow the CloudEngine NetStream block and check each line with ? help.

Type to search…

↑↓ navigate↵ selectEsc close