- Table of Contents
-
- 13-Network Management and Monitoring Configuration Guide
- 00-Preface
- 01-System Maintenance and Debugging Configuration
- 02-NQA Configuration
- 03-NTP Configuration
- 04-IPC Configuration
- 05-SNMP Configuration
- 06-RMON Configuration
- 07-CWMP Configuration
- 08-Sampler Configuration
- 09-Mirroring Configuration
- 10-Protocol Packet Statistics Configuration
- 11-sFlow Configuration
- 12-Information Center Configuration
- 13-Packet Capture Configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
11-sFlow Configuration | 124.83 KB |
Contents
Configuring the sFlow agent and sFlow collector
Displaying and maintaining sFlow
Troubleshooting sFlow configuration
The remote sFlow collector cannot receive sFlow packets
Sampled Flow (sFlow) is a traffic monitoring technology used to collect and analyze traffic statistics.
As shown in Figure 1, the sFlow system involves an sFlow agent embedded in a switch and a remote sFlow collector. The sFlow agent collects traffic statistics and packet information from the sFlow-enabled interfaces on the switch, and encapsulates them into sFlow packets. When an sFlow packet buffer overflows, or an sFlow packet ages out (the aging time is 1 second), the sFlow agent sends the packet to the sFlow collector. The sFlow collector analyzes the sFlow packets and displays the results.
sFlow has the following sampling mechanisms:
· Flow sampling—Obtains packet content information.
· Counter sampling—Obtains port traffic statistics.
Figure 1 sFlow system
As a traffic monitoring technology, sFlow has the following advantages:
· Supporting traffic monitoring on Gigabit and higher-speed networks.
· Providing good scalability to allow one sFlow collector to monitor multiple or more sFlow agents.
· Saving cost by embedding the sFlow agent in a switch, instead of using a dedicated sFlow agent switch.
sFlow configuration task list
Tasks at a glance |
(Required.) Configuring the sFlow agent and sFlow collector |
Perform at least one of the following tasks: |
Configuring the sFlow agent and sFlow collector
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Specify the IP address for the sFlow agent. |
sflow agent { ip ip-address | ipv6 ipv6-address } |
Optional. By default, no IP address is configured for the sFlow agent. The device periodically checks whether the sFlow agent has an IP address. If not, the device automatically selects an IPv4 address for the sFlow agent but does not save the IPv4 address in the configuration file. NOTE: · H3C recommends configuring an IP address manually for the sFlow agent. · Only one IP address can be specified for the sFlow agent on the device. |
3. Configure information about the sFlow collector. |
sflow collector collector-id { [ vpn-instance vpn-instance-name ] { ip ip-address | ipv6 ipv6-address } | datagram-size size | description text | port port-number | time-out seconds } * |
By default, the device presets a number of sFlow collectors. Use the display sflow command to display the parameters of the preset sFlow collectors. |
4. Specify the source IP address of sFlow packets. |
sflow source { ip ip-address | ipv6 ipv6-address } * |
Optional. Not specified by default. |
Configuring flow sampling
Perform this task to configure flow sampling on an Ethernet interface. The sFlow agent samples packets on that interface according to the configured parameters, encapsulates them into sFlow packets, and sends them in UDP packets to the specified sFlow collector.
To configure flow sampling:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enter Ethernet interface view. |
interface interface-type interface-number |
N/A |
3. Set the Flow sampling mode. |
sflow sampling-mode { determine | random } |
Optional. The default mode is determine. The random sampling mode is not supported in the current software. The random keyword is reserved for future support. |
4. Set the rate for flow sampling. |
sflow sampling-rate rate |
No packet is sampled by default. |
5. Set the maximum copied length of a sampled packet. |
sflow flow max-header length |
Optional. By default, up to 128 bytes of a sampled packet can be copied. H3C recommends using the default value. |
6. Specify the sFlow collector for flow sampling. |
sflow flow collector collector-id |
No collector is specified for flow sampling by default. |
Configuring counter sampling
Perform this task to configure counter sampling on an Ethernet interface. The sFlow agent periodically collects counter information on that interface, encapsulates the information into sFlow packets, and sends them in UDP packets to the specified sFlow collector.
To configure counter sampling:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Enter Ethernet interface view. |
interface interface-type interface-number |
N/A |
3. Set the interval for counter sampling. |
sflow counter interval seconds |
Counter sampling is disabled by default. |
4. Specify the sFlow collector for counter sampling. |
sflow counter collector collector-id |
No collector is specified for counter sampling by default. |
Displaying and maintaining sFlow
Task |
Command |
Remarks |
Display sFlow configuration and operation information (in standalone mode). |
display sflow [ slot slot-number ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display sFlow configuration and operation information (in IRF mode). |
display sflow [ chassis chassis-number slot slot-number ] [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
sFlow configuration example
By default, Ethernet, VLAN, and aggregate interfaces are down. Before configuring them, bring them up with the undo shutdown command.
Network requirements
As shown in Figure 2, configure flow sampling and counter sampling on GigabitEthernet 3/0/2 of the device to monitor traffic on the port. Configure the device to send sampled information in sFlow packets through GigabitEthernet 3/0/1 to the sFlow collector.
Configuration procedure
1. Configure the sFlow agent and sFlow collector information:
# Add GigabitEthernet 3/0/1 to VLAN 2, and configure the IP address of VLAN-interface 2.
<Device> system-view
[Device] vlan 2
[Device-vlan2] quit
[Device] interface gigabitethernet 3/0/1
[Device-GigabitEthernet3/0/1] port access vlan 2
[Device-GigabitEthernet3/0/1] quit
[Device] interface vlan-interface 2
[Device-Vlan-interface2] ip address 3.3.3.1 16
[Device-Vlan-interface2] quit
# Specify the IP address of the sFlow agent.
[Device] sflow agent ip 3.3.3.1
# Configure information about the sFlow collector: specify the sFlow collector ID as 2, IP address as 3.3.3.2, port number as 6343 (default), and description as netserver.
[Device] sflow collector 2 ip 3.3.3.2 description netserver
2. Configure counter sampling:
# Enable counter sampling and set the counter sampling interval to 120 seconds on GigabitEthernet 3/0/2.
[Device] interface GigabitEthernet 3/0/2
[Device-GigabitEthernet3/0/2] sflow counter interval 120
# Specify sFlow collector 2 for counter sampling.
[Device-GigabitEthernet3/0/2] sflow counter collector 2
3. Configure flow sampling:
# Configure flow sampling in random mode and set the sampling rate to 4000.
[Device-GigabitEthernet3/0/2] sflow sampling-mode determine
[Device-GigabitEthernet3/0/2] sflow sampling-rate 4000
# Specify sFlow collector 2 for flow sampling.
[Device-GigabitEthernet3/0/2] sflow flow collector 2
# Display the sFlow configuration and operation information.
<Device> display sflow
sFlow Version: 5
sFlow Global Information:
Agent IP:3.3.3.1(CLI)
Source Address:
Collector Information:
ID IP Port Aging Size VPN-instance Description
1 6343 0 1400
2 3.3.3.2 6543 N/A 1400 netserver
3 6343 0 1400
4 6343 0 1400
5 6343 0 1400
6 6343 0 1400
7 6343 0 1400
8 6343 0 1400
9 6343 0 1400
10 6343 0 1400
sFlow Port Information:
Interface CID Interval(s) FID MaxHLen Rate Mode Status
GE3/0/2 2 120 2 128 4000 determine Active
The output shows that GigabitEthernet 3/0/2 enabled with sFlow is active, the counter sampling interval is 120 seconds, and the Flow sampling rate is 4000.
Troubleshooting sFlow configuration
The remote sFlow collector cannot receive sFlow packets
Symptom
The remote sFlow collector cannot receive sFlow packets.
Analysis
The possible reasons are:
· The sFlow collector is not specified.
· sFlow is not configured on the interface.
· The IP address of the sFlow collector specified on the sFlow agent is different from that of the remote sFlow collector.
· No IP address is configured for the Layer 3 interface on the switch, or the IP address is configured, but UDP packets with the IP address being the source cannot reach the sFlow collector.
· The physical link between the switch and the sFlow collector fails.
Solution
To resolve the problem:
1. Verify that sFlow is correctly configured by using the display sflow command.
2. Verify that a correct IP address is configured for the switch to communicate with the sFlow collector.
3. Verify that the physical link between the switch and the sFlow collector is operating correctly.