Configuring the sFlow agent

  1. Configure one or more sFlow collectors with the command sflow collector. This determines where the sFlow agent sends sFlow information.
  2. Enable the sFlow agent on all interfaces, or on a specific interface, with the command sflow.
  3. Define the address of the sFlow agent with the command sflow agent-ip.
  4. By default, the source IP address for sFlow datagrams is set to the IP address of the outgoing switch interface on which the sFlow client is communicating with a collector. Since the switch can have multiple routing interfaces, datagrams can potentially be sent on different paths at different times, resulting in different source IP addresses for the same client. To resolve this issue, define a single source IP address. For details, see Single source IP address in the Fundamentals Guide.
  5. For most deployments, the default values for the following settings do not need to be changed. If your deployment requires different settings, change the default values with the indicated commands:
    sFlow setting Default value Command to change it
    Rate at which packets are sampled. 1 in every 4096 packets sflow sampling
    Rate at which the switch sends data to an sFlow collector. 30 seconds sflow polling
    Size of the sFlow header. 128 bytes sflow header-size
    Maximum size of an sFlow datagram. 1400 bytes sflow max-datagram-size
  6. Review sFlow configuration settings with the command show sflow.


This example creates the following configuration:

  • Configures an sFlow collector with the IP address .
  • Enables the sFlow agent on all interfaces.
  • Defines the sFlow agent IP address to be
switch(config)# sflow collector
switch(config)# sflow
switch(config)# sflow agent-ip