sFlow

This configuration context enables packet sampling and interface statistics polling. It is based on an open standard, (sFlow).

  • To configure sFlow, enter the configuration context then type sflow:
router{conf:myconf}sflow
router{conf:myconf-sflow}display
polling 30
sampling other 512
sampling 100M 128
sampling 1G 1024
sampling 10G 8192
sampling 40G 32768
router{conf:myconf-sflow}<?>
Valid entries at this position are:
  collector                Add an sFlow collector
  delete                   Delete file or configuration item
  help                     Display help information
  pcap                     Add monitored interface
  polling                  Set polling interval
  sampling                 Set sampling for a specific interface speed

router{conf:myconf-sflow}
  • To reset the sFlow configuration, leave the sflow context then type delete sflow:
router{conf:myconf-sflow}exit
router{conf:myconf}delete sflow
router{conf:myconf}display sflow
router{conf:myconf}
  • You can check if the service is currently running with the show service command:
router{}show service
[...]
Service  sFlow           is active
router{}

Note

The service is active only if, at least, one collector is defined and one interface is monitored.

Configuring sFlow traffic monitoring

Configuring the polling interval

  • Set polling interval to a specific value:
router{conf:myconf-sflow}polling INTERVAL
INTERVAL
Polling interval, in seconds.
  • Set polling interval to the default value:
router{conf:myconf-sflow}polling default
  • Disable polling:
router{conf:myconf-sflow}polling disable

Example

router{conf:myconf-sflow}polling 10

Every 10 seconds, an sFlow frame with interface statistics and system statistics (processed packets, processed bytes, errors, etc.) is sent to the collectors.

Configuring the packet sampling

The packet sampling is configurable according to the interface speed.

  • Set packet sampling for all interface speeds:
router{conf:myconf-sflow}sampling all SAMP
SAMP
The sampling rate. For better performance, the sampling value should be set to a power of two because it allows the dataplane to use a bitmask while other values means that a modulo should be used.
  • Set packet sampling for all interface speeds to their default value:
router{conf:myconf-sflow}sampling all default

Note

The default value can differ depending on the interface speed (e.g. The default packet sampling rate is 128 for a 100 megabytes interface and 1024 for a 1 gigabytes).

  • Disable packet sampling for all interface speeds:
router{conf:myconf-sflow}sampling all disable
  • Set packet sampling for a specific interface speed:
router{conf:myconf-sflow}sampling 100M|1G|10G|40G SAMP
100M
Set the sampling rate for 100 megabytes interfaces.
1G
Set the sampling rate for 1 gigabyte interfaces.
10G
Set the sampling rate for 10 gigabytes interfaces.
40G
Set the sampling rate for 40 gigabytes interfaces.
SAMP
The sampling rate. For better performance, the sampling value should be set to a power of two.
  • Set the packet sampling for a specific interface speed to the default value:
router{conf:myconf-sflow}sampling 100M|1G|10G|40G default
  • Disable the packet sampling for a specific interface speed:
router{conf:myconf-sflow}sampling 100M|1G|10G|40G disable
  • Set the packet sampling for interfaces for which the speed has not been detected:
router{conf:myconf-sflow}sampling other SAMP
  • Set the packet sampling for interfaces for which the speed has not been detected to the default value:
router{conf:myconf-sflow}sampling other default
  • Disable the packet sampling for interfaces for which the speed has not been detected:
router{conf:myconf-sflow}sampling other disable

Example

router{conf:myconf-sflow}sampling all 128
router{conf:myconf-sflow}display
polling 30
sampling other 128
sampling 100M 128
sampling 1G 128
sampling 10G 128
sampling 40G 128
router{conf:myconf-sflow}

Here packet sampling is configured to 128, i.e. for 128 packets transmitted or received by an interface, one will be sent in sFlow format to the collector(s).

The sampling value is in fact an average; the real sampling is done randomly.

Configure collectors

traffic information is sent in UDP dataframes to a collector. It is defined by an IPv4 or IPv6 address and an UDP port.

  • Send traffic information to the collector 1.0.0.2:5000:
router{conf:myconf-sflow}collector 1.0.0.2 5000

If the port is not set, the system will use the default one (6343).

  • Delete the collector:
router{conf:myconf-sflow}delete collector 1.0.0.2 5000

Note

The port number is optional.

Example

router{conf:myconf-sflow}collector 1.0.0.2
router{conf:myconf-sflow}collector 2.0.0.2 5000
router{conf:myconf-sflow}display
polling 30
sampling other 512
sampling 100M 128
sampling 1G 1024
sampling 10G 8192
sampling 40G 32768
# COLLECTORS
  collector 1.0.0.2 6343
  collector 2.0.0.2 5000
router{conf:myconf-sflow}

Configure packet capture devices

Use the pcap command to define the list of interfaces to monitor:

  • Monitor eth1 and eth2 interfaces:
router{conf:myconf-sflow}pcap interface eth1 eth2

Note

pcap interface call will replace interfaces previously added.

  • Reset the monitored interface list:
router{conf:myconf-sflow}delete pcap interface all

Example

router{conf:myconf-sflow}pcap interface eth1 eth2
router{conf:myconf-sflow}display
polling 30
sampling other 512
sampling 100M 128
sampling 1G 1024
sampling 10G 8192
sampling 40G 32768
pcap interface eth1 eth2
router{conf:myconf-sflow}pcap interface eth3 eth4
router{conf:myconf-sflow}display
polling 30
sampling other 512
sampling 100M 128
sampling 1G 1024
sampling 10G 8192
sampling 40G 32768
pcap interface eth3 eth4
router{conf:myconf-sflow}