21.2.3 Sample setting of sFlow statistical configuration parameter
- <Structure of this section>
(1) Adjusting MTU Length and sFlow Packet-Size
- Points to note
-
By default, sFlow packets with a maximum of 1400 bytes are sent to a collector. If the MTU value of the line to the collector is large, adjust the packet size to the same size as the MTU value so that packets can be sent efficiently to the collector. This subsection describes the setting when a line with an MTU length of 8000 bytes is connected to a collector.
Figure 21-9: Example of setting send to collectors as MTU=8000byte
Command examples
-
(config)# sflow destination 192.1.1.12
Sets the IP address 192.1.1.12 for the collector.
-
(config)# sflow sample 512
Monitors the traffic every 512 packets.
-
(config)# sflow max-packet-size 8000
Sets the maximum sFlow packet size to 8000 bytes.
-
(config)# interface gigabitethernet 1/0/4
Switches to Ethernet interface configuration mode for ports 1, 0, and 4.
-
(config-if)# sflow forward ingress
Enables the sFlow statistics functionality for packets received on port 1/0/4.
(2) Narrow down the information you want to collect
- Points to note
-
All information about sFlow packets is collected by the default configuration. If you want to decrease CPU usage, you can change the configuration settings so that unnecessary information will not be collected. This subsection describes the configuration when only IP address information is needed.
Command examples
-
(config)# sflow destination 192.1.1.12
Sets the IP address 192.1.1.12 for the collector.
-
(config)# sflow sample 512
Monitors the traffic every 512 packets.
-
(config)# sflow packet-information-type ip
Sets the IP format as the basic data format for flow samples.
-
(config)# sflow extended-information-type router
Sets router as the extended data format for flow samples (only router information can be retrieved).
-
(config)# interface gigabitethernet 1/0/4
Switches to Ethernet interface configuration mode for ports 1, 0, and 4.
-
(config-if)# sflow forward ingress
Enables the sFlow statistics functionality for packets received on port 1/0/4.
(3) Fix the agent IP for sFlow packets
- Points to note
-
A normal collector determines if a switch is the same switch based on the agent IP address contained in an sFlow packet. Therefore, if the agent IP address is not set by using the sflow source or interface loopback command, the collector might display the status as if packets had been sent from multiple switches. To see long-term information, fix the agent IP address. This subsection describes configuration for sending packets to a collector by using the IP address assigned to loopback as the agent IP address.
Command examples
-
(config)# interface loopback 0
Switches to the loopback interface configuration mode.
-
(config-if)# ip address 176.1.1.11
Configures the loopback interface as 176.1.1.11 for IPv4.
-
(config-if)# ipv6 address 3ffe:100::1
(config-if)# exit
Configures the loopback interface as 3ffe:100::1 for IPv6.
-
(config)# sflow destination 192.1.1.12
Sets the IP address 192.1.1.12 for the collector.
-
(config)# sflow sample 512
Monitors the traffic every 512 packets.
-
(config)# interface gigabitethernet 1/0/4
Switches to Ethernet interface configuration mode for ports 1, 0, and 4.
-
(config-if)# sflow forward ingress
Enables the sFlow statistics functionality for packets received on port 1/0/4.
- Notes
-
When the loopback IP address is used, configuration using the sflow source command is not needed. If the IP address is specified by using the sflow source command, then the specified IP address takes priority.
(4) Collecting URL data on a local network
- Points to note
-
When URL information (HTTP packets) is collected by using the sFlow statistics functionality on the Switch, the default destination port number is set to 80. However, in a local network, the port number might be different. The following describes configuration when port 8080 is used for HTTP packets in a local network environment.
Command examples
-
(config)# sflow destination 192.1.1.12
Sets the IP address 192.1.1.12 for the collector.
-
(config)# sflow sample 512
Monitors the traffic every 512 packets.
-
(config)# sflow url-port-add 8080
When URL information is used in the extended data format, configure an additional destination port number 8080 for packets that are determined to be HTTP packets.
-
(config)# interface gigabitethernet 1/0/4
Switches to Ethernet interface configuration mode for ports 1, 0, and 4.
-
(config-if)# sflow forward ingress
Enables the sFlow statistics functionality for packets received on port 1/0/4.
- Notes
-
Even after this parameter has been configured, destination port number 80 is valid for HTTP packets.