Configure the Agent IP Address and Enable sFlow Globally

Configure the sFlow agent IPv4 address, and then enable sFlow before the system can monitor and capture traffic statistics to send to an sFlow collector. By default, sFlow is globally disabled.

You can configure sFlow on Segmented Management Instance interfaces OOB, VLAN, and CLIP. You can also use routing VLANs or loopback IPs as the source IP address. Configure the agent IP address to match the Management Instance interface, routing VLAN or loopback IP address.

Procedure

  1. Enter Global Configuration mode:

    enable

    configure terminal

  2. Configure the sFlow source IP address:

    sflow agent–ip {A.B.C.D}

  3. Configure the sFlow collector:

    sflow collector <1-2> address {A.B.C.D}

  4. Configure the sFlow destination port number:

    sflow collector <1-2> port <1-65535>

  5. Configure the sFlow collector timeout:

    sflow collector <1-2> timeout <1-65535>

  6. Enter GigabitEthernet Interface Configuration mode to bind the port the collector:

    interface GigabitEthernet {slot/port[/sub-port][-slot/port[/sub-port]][,...]}

    Note

    Note

    If the platform supports channelization and the port is channelized, you must also specify the sub-port in the format slot/port/sub-port.

  7. Optional: Configure the interface sampling rate:

    sflow sampling-rate <1024-100000>

  8. Optional: Configure the interface counter intervals:

    sflow counter-interval <1-3600>

  9. Optional: Configure the interface max header size:

    sflow max-header-size <64-256>

  10. Enable sFlow:

    sflow enable

Example

Displays sFlow configuration:

Switch:1(config)#show sflow

===============================================================================================
                           sFlow Global Configuration
===============================================================================================
        Global State                   : Enabled
        Agent  IP                      : 192.0.2.27

Displays sflow collector configuration:

Switch:1(config)#show sflow collector

=======================================================================================
                          sFlow Collector Information
=======================================================================================
Id    Owner            Collector-IP      Port       Timeout(secs)   Reachable via
---------------------------------------------------------------------------------------
1     sflow1           192.0.2.26        6343       497             192.0.2.15
2     sflow2           192.0.2.27        6343       531             192.0.2.16
---------------------------------------------------------------------------------------

Displays sFlow port configuration:

Switch:1(config)#show sflow interface

====================================================================================================
                         sFlow Port Configuration Info
====================================================================================================
Port   Packet-Sample-Rate  Max-Header-Size Counter-interval  Collector-list
                                           (in secs)
----------------------------------------------------------------------------------------------------
1/1    0                   255             525               1,2
1/2    0                   255             525               1,2

Displays sFlow statistics:

Switch:1(config)#show sflow statistics

====================================================================================================
                             sFlow Statistics Info
====================================================================================================
Collector-id                  sFlow-Datagrams
----------------------------------------------------------------------------------------------------
1                             1001
2                             0
----------------------------------------------------------------------------------------------------

Variable Definitions

The following table defines parameters for the sflow commands related to configuring sFlow as the source IP.

Variable

Value

agent-ip

Specifies the agent-ip address (IPv4).

collector <1–2>

Specifies the id to export sFlow datagrams to the collector id.

Use the no operator to remove an sflow collector id and a collector name. no sflow collector <1–2> owner WORD<1–20>

To configure the default value, enter default sflow collector <1–2>

address {A.B.C.D.}

Specifies the collector IP address.

Use the no operator to remove an sflow collector address. no sflow collector <1–2> address {A.B.C.D}

owner WORD<1-20>

Specifies the sFlow collector name.

port <1–65535>

Specifies the destination UDP port. The default port is 6343.

To configure the default value, enter default sflow collector <1–2> port

timeout <1–65535>

Specifies the time remaining (in seconds) before the collector is released.

The default timeout is 0, which means the timeout is not used and the collector sends data forever.

To configure the default value, enter default sflow collector <1–2> timeout

sampling-rate <1024-1000000>

Configures the packet sampling rate on a port.

The default value is 0 (disabled). To configure the default value, enter default sflow sampling-rate.

counter-interval <1-3600>

Specifies the polling interval on a port to determine how often the sFlow agent polls and exports counters for a configured interface.

The default value is 0 (disabled).

max-header-size <64-256>

Specifies the maximum number of bytes to be copied from the sampled packet.

The default is 128 bytes.