How to view traffic policy statistics

1

You can run the display traffic policy statistics command to view statistics on the interface where a traffic policy has been applied, or run the display current-configuration command to view all configurations.

Other related questions:
How to check statistics about the traffic policy
Run the display traffic policy statistics command to check statistics on the interface where a traffic policy has been applied. Run the display cu command to check the configuration.

How do I view and clear traffic statistics on an interface

To view traffic statistics on an interface, run the display interface [ interface-type [ interface-number [.subnumber] ] ] command in any view, or run the display this interface command in the interface view.

To clear the traffic statistics on an interface, run the reset counters interface [ interface-type [ interface-number ] command in the user view.


How to configure a CE series switch to collect traffic statistics using traffic policies
- Configure a switch to collect statistics on traffic from a specified host. In the following example, the switch is configured to collect traffic statistics on packets with the source MAC address of 0000-0000-0003. <HUAWEI> system-view [~HUAWEI] acl 4000 [*HUAWEI-acl-L2-4000] rule permit source-mac 0000-0000-0003 ffff-ffff-ffff [*HUAWEI-acl-L2-4000] quit [*HUAWEI] traffic classifier c1 [*HUAWEI-classifier-c1] if-match acl 4000 [*HUAWEI-classifier-c1] quit [*HUAWEI] traffic behavior b1 [*HUAWEI-behavior-b1] statistic enable [*HUAWEI-behavior-b1] quit [*HUAWEI] traffic policy p1 [*HUAWEI-trafficpolicy-p1] classifier c1 behavior b1 [*HUAWEI-trafficpolicy-p1] quit [*HUAWEI] interface 10ge 1/0/1 [*HUAWEI-10GE1/0/1] traffic-policy p1 inbound [*HUAWEI-10GE1/0/1] traffic-policy p1 outbound [*HUAWEI-10GE1/0/1] quit [*HUAWEI] commit - Configure a switch to collect traffic statistics on ICMP packets received and sent on an interface. <HUAWEI> system-view [~HUAWEI] acl 3000 [*HUAWEI-acl4-advance-3000] rule 0 permit icmp source 192.168.1.1 0 destination 192.168.2.1 0 [*HUAWEI-acl4-advance-3000] rule 5 permit icmp source 192.168.2.1 0 destination 192.168.1.1 0 [*HUAWEI-acl4-advance-3000] quit [*HUAWEI] traffic classifier c1 [*HUAWEI-classifier-c1] if-match acl 3000 [*HUAWEI-classifier-c1] quit [*HUAWEI] traffic behavior b1 [*HUAWEI-behavior-b1] statistic enable [*HUAWEI-behavior-b1] quit [*HUAWEI] traffic policy p1 [*HUAWEI-trafficpolicy-p1] classifier c1 behavior b1 [*HUAWEI-trafficpolicy-p1] quit [*HUAWEI] interface 10ge 1/0/1 [*HUAWEI-10GE1/0/1] traffic-policy p1 inbound [*HUAWEI-10GE1/0/1] traffic-policy p1 outbound [*HUAWEI-10GE1/0/1] quit [*HUAWEI] commit - Configure a switch to collect traffic statistics on ARP packets received and sent on an interface. <HUAWEI> system-view [~HUAWEI] traffic classifier arp-request [*HUAWEI-classifier-arp-request] if-match l2-protocol arp [*HUAWEI-classifier-arp-request] if-match source-mac 1111-1111-1111 [*HUAWEI-classifier-arp-request] if-match destination-mac ffff-ffff-ffff [*HUAWEI-classifier-arp-request] quit [*HUAWEI] traffic classifier arp-reply [*HUAWEI-classifier-arp-reply] if-match l2-protocol arp [*HUAWEI-classifier-arp-reply] if-match source-mac 2222-2222-2222 [*HUAWEI-classifier-arp-reply] if-match destination-mac 1111-1111-1111 [*HUAWEI-classifier-arp-reply] quit [*HUAWEI] traffic behavior b1 [*HUAWEI-behavior-b1] statistic enable [*HUAWEI-behavior-b1] quit [*HUAWEI] traffic policy arp-request [*HUAWEI-trafficpolicy-arp-request] classifier arp-request behavior b1 [*HUAWEI-trafficpolicy-arp-request] quit [*HUAWEI] traffic policy arp-reply [*HUAWEI-trafficpolicy-arp-reply] classifier arp-reply behavior b1 [*HUAWEI-trafficpolicy-arp-reply] quit [*HUAWEI] interface 10ge 1/0/1 [*HUAWEI-10GE1/0/1] traffic-policy arp-request inbound [*HUAWEI-10GE1/0/1] traffic-policy arp-reply outbound [*HUAWEI-10GE1/0/1] quit [*HUAWEI] commit - Check packet statistics. After configuring a switch to collect packet statistics using a traffic policy, run the following command to view packet statistics. # Display the statistics on incoming packets matching a rule after the traffic policy is applied to the system. <HUAWEI> display traffic-policy statistics global inbound rule-base Traffic policy: p1, inbound -------------------------------------------------------------------------------- Classifier: c1, Behavior: b1 Slot : 1 ---------------------------------------------------------------------------- if-match any Passed Packets 2100593, Passed Bytes 135076448 Dropped Packets 9269310796, Dropped Bytes 595376105640 ----------------------------------------------------------------------------

In what order does an applied traffic policy take effect on S series switches
For S series switches (except the S1700), a traffic policy can be applied in the system view, interface view, and VLAN view simultaneously. When applying a traffic policy in multiple views, configure the traffic policy in the sequence of interface view, VLAN view, and system view. When multiple traffic policies are applied in different views and packets simultaneously match different traffic policies, the traffic policies take effect in the following orders: - If traffic classification rules in the traffic policies are of the same type, that is, the rules are all user-defined ACL rules, Layer 2 rules, or Layer 3 rules, only one traffic policy takes effect. The traffic policy that takes effect depends on the view in which the traffic policy has been applied. The view priority is as follows: interface view > VLAN view > system view. - For cards of modular switches except X series cards and fixed switches S5700HI, S5700EI, S5710EI, S5720EI, S5710HI, S6700EI, S6720EI, and S6720S-EI, if traffic classification rules in the traffic policies are of different types and actions in traffic behaviors do not conflict, traffic policies in all views take effect. If actions in traffic behaviors conflict, only one traffic policy takes effect and the traffic policy that takes effect is relevant to rules. The rule priority is as follows: Layer 2 rule and Layer 3 rule > advanced ACL6 rule > basic ACL6 rule > Layer 3 rule > Layer 2 rule > user-defined ACL rule. - For X series cards of modular switches and E series and S series fixed switches S600-E, S1720GFR, S1720GW-E, S1720GWR-E, S2720, S2750, 5700SI, S5700LI, S5700S-LI, S5720LI, S5720S-LI, S5710-X-LI, S5720SI, S5720S-SI, and S5720HI, if traffic classification rules in the traffic policies are of different types, the traffic policy in only one view takes effect and the traffic policy that takes effect is relevant to the view in which it is applied. The view priority is as follows: interface view > VLAN view > system view. It is recommended that you configure the traffic policy based on the priority. Otherwise, the configured traffic policy may not take effect immediately. Note: MQC cannot be configured on the S2700SI.

If you have more questions, you can seek help from following ways:
To iKnow To Live Chat
Scroll to top