Configuring sFlow
NOTE:
SFlow service runs in management VRF by default. If you use Ethernet management interface Eth0/1 to connect with the sFlow Collector, you do not need to do the following operations.
However, if the L3 VLAN interface is used to connect with the sFlow Collector, the sFlow service cannot run normally by default, as all the L3 VLAN interface is in the default VRF by default. You need to modify the configurations to make the L3 VLAN interface management interface and sFlow service run in the same VRF, so as to run the sFlow service normally. You can choose either one of the following two ways:
Way 1. Use the command set protocols sflow collector <ip-address> vrf default to move sFlow service to run in the default VRF. This way is recommended.
Way 2. Use the command set l3-interface vlan-interface <interface-name> vrf mgmt-vrf to move the L3 VLAN interface connected to the sFlow Collector to management VRF.
Globally Enabling sFlow
By default, sFlow is disabled. User can enable sFlow and configure the parameters, verify that the switch can connect to the sFlow collector server, and configure the sFlow agent-id and source-address at the same time that sFlow is enabled.
admin@XorPlus# set protocols sflow disable false admin@XorPlus# set protocols sflow agent-id 10.10.50.248 admin@XorPlus# set protocols sflow source-address 10.10.50.248 admin@XorPlus# commit Waiting for merging configuration. Commit OK. Save done. admin@XorPlus#
Configuring sFlow Parameters
User can configure global parameters for sFlow, including agent-id, collector IP, polling-interval, sampling-rate, and source-address.
admin@XorPlus# set protocols sflow agent-id 10.10.50.248 admin@XorPlus# set protocols sflow collector 10.10.50.221 udp-port 6343 admin@XorPlus# set protocols sflow polling-interval 30 admin@XorPlus# set protocols sflow sampling-rate ingress 2000 admin@XorPlus# set protocols sflow sampling-rate egress 2000 admin@XorPlus# set protocols sflow header-len 128 admin@XorPlus# set protocols sflow source-address 10.10.50.248 admin@XorPlus# commit Waiting for merging configuration. Commit OK. Save done. admin@XorPlus# run show sflow sFlow : Enabled Agent ID : 10.10.50.248 Source Address : 10.10.50.248 Sample rate ingress: 1:2000 Sample rate egress : 1:2000 Polling interval : 30 seconds Header Length : 128 admin@XorPlus# admin@XorPlus# run show sflow collector Collector address UDP-port No of Samples ----------------- -------- ------------- 10.10.50.221 6343 5336 admin@XorPlus#
Configuring sFlow on a Specific Interface
User can configure sFlow parameters on a specific interface but needs to enable sflow protocols on global first.
admin@XorPlus# set protocols sflow interface ge-1/1/1 ? Possible completions: <[Enter]> Execute this command disable Disable sflow on all interfaces by default header-len The Length of sampled packet in bytes, 64 by default polling-interval How often the sflow agent polls the interface in seconds, 30 by default sampling-rate The rate at which packets must be sampled, 2000 by default admin@XorPlus# set protocols sflow interface ge-1/1/1 disable false admin@XorPlus# set protocols sflow interface ge-1/1/1 header-len 128 admin@XorPlus# set protocols sflow interface ge-1/1/1 polling-interval 10 admin@XorPlus# set protocols sflow interface ge-1/1/1 sampling-rate ingress 1000 admin@XorPlus# commit
In the current version, sFlow samples only the ingress traffic of each interface. User can monitor the traffic with sFlow Trend.
Copyright © 2025 Pica8 Inc. All Rights Reserved.