Configuring a Traffic Classifier
Pre-configuration Tasks
Configuring link layer attributes of interfaces to ensure that the interfaces work properly
Configuring an ACL if the ACL needs to be used to classify traffic
Configuration Process
The rules that do not conflict can be configured in a traffic classifier.
Procedure
Run:
system-view
The system view is displayed.
Run:
traffic classifier classifier-name [ operator { and | or } ]
A traffic classifier is created and the traffic classifier view is displayed, or the existing traffic classifier view is displayed.
and indicates that rules are ANDed with each other.If a traffic classifier contains ACL rules, packets match the traffic classifier only when the packets match one ACL rule and all the non-ACL rules.
If a traffic classifier does not contain ACL rules, packets match the traffic classifier only when the packets match all the non-ACL rules.
By default, the relationship between rules in a traffic classifier is AND.
- Run the following commands as required.
Matching Rule
Command
Remarks
Inner and outer VLAN IDs in QinQ packets
if-match cvlan-id start-vlan-id [ to end-vlan-id ] [ vlan-id vlan-id ] (Other models except S2700SI support this command.)
-
802.1p priority in VLAN packets
if-match 8021p 8021p-value &<1-8> Regardless of whether the relationship between rules in a traffic classifier is AND or OR, if you enter multiple values of 802.1p priorities, the packet that matches one 802.1p priority matches the traffic classifier.
Inner 802.1p priority in QinQ packets
if-match cvlan-8021p 8021p-value &<1-8>
-
Outer VLAN ID or inner and outer VLAN IDs of QinQ packets
if-match vlan-id start-vlan-id [ to end-vlan-id ] [ cvlan-id cvlan-id ] -
Drop packet
if-match discard(S2700-52P-EI, S2700-52P-PWR-EI, S2710SI, S3700SI, and S3700EI) A traffic classifier containing a matching rule based on the drop packets can be only bound to traffic behaviors containing traffic statistics and flow mirroring.
Double tags in QinQ packets
if-match double-tag(S2700-52P-EI, S2700-52P-PWR-EI, S2710SI, S3700SI, and S3700EI) -
Destination MAC address
if-match destination-mac mac-address [ mac-address-mask ] -
Source MAC address
if-match source-mac mac-address [ mac-address-mask ] -
Protocol type field encapsulated in the Ethernet frame header
if-match l2-protocol { arp | ip | mpls | rarp | protocol-value } -
All packets
if-match any After the if-match any command is run, only the matching rule configured using this command takes effect, and the other matching rules in the same traffic classifier will become ineffective.
DSCP priority in IP packets
if-match dscp dscp-value &<1-8>(S2700-52P-EI, S2700-52P-PWR-EI, S2710SI, S3700SI, and S3700EI)
Regardless of whether the relationship between rules in a traffic classifier is AND or OR, if you enter multiple values of DSCP priorities, the packet that matches one DSCP priority matches the traffic classifier.
If the relationship between rules in a traffic classifier is OR, the if-match dscp and if-match ip-precedence commands cannot be used in the traffic classifier simultaneously.
IP precedence in IP packets
if-match ip-precedence ip-precedence-value &<1-8> The if-match dscp and if-match ip-precedence commands cannot be configured in a traffic classifier in which the relationship between rules is AND.
Regardless of whether the relationship between rules in a traffic classifier is AND or OR, if you enter multiple values of IP priorities, the packet that matches one IP priority matches the traffic classifier.
Layer 3 protocol type
if-match protocol { ip | ipv6 } -
SYN Flag in the TCP packet header
if-match tcp syn-flag { syn-flag-value | ack | fin | psh | rst | syn | urg }
-
Inbound interface
if-match inbound-interface interface-type interface-number The traffic policy containing this matching rule cannot be applied to the outbound direction.
The traffic policy containing this matching rule cannot be applied in the interface view.Outbound interface
if-match outbound-interface interface-type interface-number(S2700-52P-EI, S2700-52P-PWR-EI, S2710SI, S3700SI, and S3700EI) The traffic policy containing this matching rule cannot be applied to the outbound direction.
The traffic policy containing this matching rule cannot be applied in the interface view.ACL rule
if-match acl { acl-number | acl-name } NOTE:When an ACL is used to define a traffic classification rule, it is recommended that the ACL be configured first.
Regardless of whether the relationship between rules in a traffic classifier is AND or OR, if an ACL defines many rules, the packet that matches one ACL rule matches the ACL.
Run:
quit
The traffic classifier view is quitted.