Configuring sFlow



NOTEs:

  • User needs to enable sFlow on global and on the port so that it can sample flow and counters. If sFlow is only enabled on global, it will only see the port count.
  • The following sampling field of sFlow nexthop IP in sFlow version5 Extended Router Data is supported.
/* Extended Router Data */
/* opaque = flow_data; enterprise = 0; format = 1002 */
struct extended_router {
   next_hop nexthop;            /* IP address of next hop router */
   unsigned int src_mask_len;   /* Source address prefix mask
                                   (expressed as number of bits) */
   unsigned int dst_mask_len;   /* Destination address prefix mask
                                   (expressed as number of bits) */
}
  • For packets forwarded via ECMP routes, sFlow selects nexthop of one of the ECMP routes as the nexthop information of the packet in the sampling information, which may not necessarily be the nexthop of the route used for actual packet forwarding.

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 © 2024 Pica8 Inc. All Rights Reserved.