Configuring sFlow

CHAPTERS

1. Overview

2. sFlow Configuration

3. Configuration Example

4. Appendix: Default Parameters

This guide applies to:

T2600G-18TS v2 or above, T2600G-28TS v3 or above, T2600G-28MPS v3 or above, T2600G-28SQ v1 or above, T2600G-52TS v3 or above.

1Overview

sFlow (Sampled Flow) is a technology for monitoring high-speed switched and routed networks. It provide complete visibility into network activity. With sFlow, you can analyze traffic statistics and monitor the network usage, thus implement effective management and control of network resources.

The sFlow monitoring system consists of an sFlow Agent and an sFlow Collector.

sFlow Agent

The sFlow Agent is embedded in a switch or router or in a standalone probe. It uses sampling technology to capture traffic statistics from the device it is monitoring, and packages the sampled data into sFlow datagrams. sFlow datagrams are used to immediately forward the sampled data to an sFlow Collector for analysis.

The switch provides a packet-based sFlow, which samples one packet out of a specified number of packets.

sFlow Collector

The sFlow Collector is installed in a host. It analyzes sFlow datagrams to produce a rich, real-time, network-wide view of traffic flows.

2sFlow Configuration

To complete the configuration, follow these steps:

1)Configure the sFlow Agent.

2)Configure the sFlow Collector.

3)Configure the sFlow Sampler.

Configuration Guidelines

To get analytic results, you should choose a proper collector. For details on sFlow collectors, refer to http://www.sflow.org.

2.1Using the GUI

2.1.1Configuring the sFlow Agent

Choose the menu MAINTENANCE > sFlow > sFlow Agent to load the following page.

Figure 2-1 Configuring the sFlow Agent

Follow these steps to configure the sFlow Agent:

1)Enable the sFlow function, specify the sFlow Agent IP address.

sFlow Agent

Enable or disable sFlow Agent. When enabled, the switch acts as an sFlow Agent.

Agent Address

Enter the IP address of the sFlow Agent. Normally it is the management IP address of the switch.

sFlow Version

The sFlow version is v5.

2)Click Apply.

2.1.2Configuring the sFlow Collector

Choose the menu MAINTENANCE > sFlow > sFlow Collector to load the following page.

Figure 2-2 Configuring the sFlow Collector

Follow these steps to configure the sFlow Collector:

1)Select a Collector and configure the relevant parameters.

Collector ID

Displays the Collector ID. The switch supports 4 collectors at most.

Description

Give the collector a description for identification with 16 characters at most.

Collector IP

Enter the IP address of the host that runs the sFlow Collector.

Collector Port

Specify the UDP port number for the sFlow collector. The default is port 6343.

Maximum Datagram Size

Specify the maximum number of data bytes that can be sent in a single sample datagram. Valid values are from 300 to 1400 bytes and the default is 300 bytes.

Timeout (s)

Specify the aging time after which the sFlow Collector will become invalid. Valid values are from 0 to 2000000 seconds; the default is 0, which means the collector is always valid.

Lifetime (s)

Displays the remaining time of the collector. Lifetime counts down from Timeout.

2)Click Apply.

2.1.3Configuring the sFlow Sampler

An sFlow Sampler is a data source that collects flow samples. Usually the ports act as sFlow Samplers.

Choose the menu MAINTENANCE > sFlow> sFlow Sampler to load the following page.

Figure 2-3 Configuring the sFlow Sampler

Follow these steps to configure the sFlow Sampler:

1)Set one or more ports to be Samplers and configure the relevant parameters . One port can be bound to only one collector.

Collector ID

Choose a collector to be bound with the port.

Ingress Sampling Rate (Hz)

Specify the ingress sampling frequency; the sampler takes one packet out of the specified number of packets. Valid values are from 1024 to 65535. The default is 0 which means no packets will be sampled.

Egress Sampling Rate (Hz)

Specify the egress sampling frequency; the sampler takes one packet out of the specified number of packets. Valid values are from 1024 to 65535. The default is 0 which means no packets will be sampled.

Maximum Header Size (Bytes)

Specify the maximum number of bytes that should be copied from a sampled packet. Valid values are from 18 to 256 bytes and the default is 128 bytes.

LAG

Displays the LAG the port belongs to.

2)Click Apply.

2.2Using the CLI

Follow these steps to configure the sFlow:

Step 1

configure

Enter global configuration mode.

Step 2

sflow address { ipv4-addr }

Configure the IP address of sFlow Agent.

ipv4-addr: Enter the management IP address of the switch to monitor traffic on the switch ports.

Step 3

sflow enable

Enable the sFlow function.

Step 4

sflow collector collector-ID value { [descript descript ] | [ ip ip ] | [ port port ] | [ maxData maxData ] | [ timeout timeout ] }

Configure parameters of the sFlow collector.

value: Enter the ID of the sFlow collector. The values are from 1 to 4.

descript: Give a collector description for identification with 16 characters at most.

ip: Enter the IP address of the host that runs the sFlow collector.

port: Enter the UDP port number for the sFlow collector. The default is port 6343.

maxData: Specify the maximum number of data bytes that can be sent in a single sample datagram. The values are from 300 to 1400 bytes; the default is 300 bytes.

timeout: Specify the aging time after which the sFlow collector will become invalid. The values are from 0 to 2000000 seconds; the default is 0, which means the collector is always valid.

Step 5

interface {fastEthernet port | range fastEthernet port-list | gigabitEthernet port | range gigabitEthernet port-list | ten-gigabitEthernet port | range ten-gigabitEthernet port-list ]

Configure the sampler on the specified ports.

port/port-list: The number or the list of the Ethernet ports that you want to monitor.

Step 6

sflow sampler { [ collector-ID value ] | [ ingRate ingress-rate ] [ egRate egress-rate ] | [maxHeader maxHeader ] }

Configure parameters of the sFlow sampler.

value: Enter the ID of the sFlow collector which the sFlow sampler will send sFlow datagrams to. The values are from 0 to 4. 0 means sampling feature is disabled on the port.

ingress-rate: Specify the ingress sampling frequency. The samplers takes one packet out of the specified number of packets. Valid values are from 1024 to 65535. The default is 0 which means no packets will be sampled.

egress-rate: Specify the egress sampling frequency. The samplers takes one packet out of the specified number of packets. Valid values are from 1024 to 65535. The default is 0 which means no packets will be sampled.

maxHeader: Specify the maximum number of bytes that should be copied from a sampled packet. Valid values are from 18 to 256 bytes and the default is 128 bytes.

Step 7

show sflow { [ global ] | [ collector ] | [ sampler ] }

Verify the sFlow configurations.

global: View the global configuration of sFlow.

collector: View the global configuration of the sFlow collector.

sampler: View the global configuration of the sFlow sampler.

Step 8

end

Return to privileged EXEC mode.

Step 9

copy running-config startup-config

Save the settings in the configuration file.

The following example shows how to configure the switch whose IP address is 192.168.0.1 to send sFlow packets to the host whose IP address is 192.168.0.100. Set the sFlow agent IP address as 192.168.0.1, the sFlow collector IP address 1 as 192.168.0.100; configure Gigabit Ethernet port 1 as the sFlow sampler, the Collector-ID as 1, and the ingress rate as 1024:

Switch#configure

Switch(config)#sflow address 192.168.0.1

Switch(config)#sflow enable

Switch(config)#sflow collector collector-ID 1 ip 192.168.0.100

Switch(config)# sflow collector collector-ID 1 port 6343

Switch(config)#interface gigabitEthernet 1/0/1

Switch(config-if)#sflow sampler collector-ID 1

Switch(config-if)#sflow sampler ingRate 1024

Switch(config-if)#show sflow global

sFlow Status: Enable

Agent Address: 192.168.0.1

sFlow Version: v5

Switch(config-if)#show sflow collector

Collector Col-IP Col-Port MaxData Timeout Lifetime Description

-------- -------------- -------- -------- -------- -------- -----------

1 192.168.0.100 6343 300 0 0

...

Switch(config-if)#show sflow sampler

Port Collector IngRate EgRate MaxHeader LAG

---------- ---------- ---------- ---------- ---------- ---

Gi1/0/1 1 1024 0 128 N/A

Gi1/0/2 0 0 0 128 N/A

Gi1/0/3 0 0 0 128 N/A

...

Switch(config-if)#end

Switch#copy running-config startup-config

3Configuration Example

3.1Network Requirements

The company network manager needs to monitor and analyze the network usage in department A.

Figure 3-1 Network Topology

3.2Configuration Scheme

The network manager can configure sFlow to monitor and analyze the network. Set the switch as the sFlow Agent that collects traffic data on port 1/0/1, and configure an sFlow Collector on the PC to process sFlow packets and display results.

Demonstrated with T2600G-28TS, this chapter provides configuration procedures in two ways: using the GUI and Using the CLI.

3.3Using the GUI

1)Choose the menu MAINTENANCE > sFlow > sFlow Agent to load the following page. Enable sFlow Agent, set the switch IP address 192.168.0.26 as the Agent address, and click Apply.

Figure 3-2 Configuring sFlow Agent

2)Choose the menu MAINTENANCE > sFlow > sFlow Collector to load the following page. Select Collector 1, enter the PC’s IP address 192.168.0.27 as the Collector IP address, and click Apply.

Figure 3-3 Configuring sFlow Collector

3)Choose the menu MAINTENANCE > sFlow > sFlow Sampler to load the following page. Select Collector 1 for port 1/0/1, set the ingress rate as 1024, then click Apply.

Figure 3-4 Configuring sFlow Sampler

4)Click to save the settings.

3.4Using the CLI

1)Configure the sFlow Agent.

Switch#configure

Switch(config)#sflow address 192.168.0.26

Switch(config)#sflow enable

2)Configure the sFlow collector.

Switch(config)#sflow collector collector-ID 1 ip 192.168.0.27

Switch(config)# sflow collector collector-ID 1 port 6343

3)Configure the sFlow sampler.

Switch(config)#interface gigabitEthernet 1/0/1

Switch(config-if)#sflow sampler collector-ID 1

Switch(config-if)#sflow sampler ingRate 1024

Switch(config-if)#end

Switch#copy running-config startup-config

Verify the Configurations

Verify the configuration of global sFlow:

Switch#show sflow global

sFlow Status: Enable

Agent Address: 192.168.0.26

sFlow Version: v5

Verify the configuration of sFlow collector:

Switch#show sflow collector

Collector Col-IP Col-Port MaxData Timeout Lifetime Description

-------- -------------- -------- -------- -------- -------- -----------

1 192.168.0.27 6343 300 0 0

2 0.0.0.0 6343 300 0 0

3 0.0.0.0 6343 300 0 0

4 0.0.0.0 6343 300 0 0

Verify the configuration of sFlow sampler:

Switch#show sflow sampler

Port Collector IngRate EgRate MaxHeader LAG

---------- ---------- ---------- ---------- ---------- ---

Gi1/0/1 1 1024 0 128 N/A

Gi1/0/2 0 0 0 128 N/A

...

4Appendix: Default Parameters

Default settings of maintenance are listed in the following tables.

Table 4-1Default Settings of sFlow

Parameter

Default Setting

sFlow Agent

sFlow Agent

Disabled

Agent Address

0.0.0.0

sFlow Version

5

sFlow Collector

Collector IP

0.0.0.0

Collector Port

6343

Maximum Datagram Size

300 bytes

Timeout (s)

0

sFlow Sampler

Collector ID

0, indicates sampling feature is disabled on the port.

Ingress Sampling Rate (Hz)

0

Egress Sampling Rate (Hz)

0

Maximum Header Size (Bytes)

128