Configure a traffic classifier to define flows to be mirrored, configure a traffic behavior as enabling flow mirroring, and associate the traffic classifier with traffic behavior in a traffic policy.
Procedure
- Define a traffic classifier.
- Enter the system view.
system-view
- Define a traffic classifier and enter the traffic classifier view.
traffic classifier classifier-name [ operator { and | or } ]
The classifier name specified by the classifier-name parameter cannot be a predefined classifier name in the system. For details about traffic classification, see HUAWEI NetEngine 8000 F Series Router Configuration Guide - QoS.
- Run the following commands based on the networking:
- To define a rule to match traffic with a specified 802.1p priority value in VLAN packets, run the if-match 8021p 8021p-value command.
- To define an ACL rule, run the if-match [ ipv6 ] acl { acl-number | name acl-name } command.
- To define a rule to match all packets, run the if-match [ ipv6 ] any command.
- To define a rule to match traffic with a specified destination MAC address, run the if-match destination-mac mac-address command.
- To define a rule to match traffic with a specified destination IPv6 address, run the if-match ipv6 destination-address ipv6-address prefix-length command.
- To define a rule to match traffic with a specified source IPv6 address, run the if-match ipv6 source-address ipv6-address prefix-length command.
- To define a rule to match traffic with a specified DSCP value, run the if-match [ ipv6 ] dscp dscp-value command.
- To define a rule to match traffic with a specified MPLS EXP value, run the if-match mpls-exp exp-value command.
- To define a rule to match traffic with a specified IP packet priority value, run the if-match ip-precedence ip-precedence command.
- To define a rule to match traffic based on the next header field in IPv6 packets, run the if-match ipv6 next-header header-number first-next-header command.
- To define a rule to match traffic with a specified source MAC address, run the if-match source-mac mac-address command.
- To define a rule to match traffic based on the IPv4 TCP flag, run the if-match tcp syn-flag { tcpflag-value [ mask tcpflag-mask ] | bit-match { established | fin | syn | rst | psh | ack | urg | ece | cwr | ns } } command.
- To define a rule to match traffic based on the IPv6 TCP flag, run the if-match ipv6 tcp syn-flag { tcpflag-value [ mask tcpflag-mask ] | bit-match { established | fin | syn | rst | psh | ack | urg } } command.
You can configure one or several rules in Step 3 as needed.
On a device functioning as a PE, run either or both of the following commands as needed:
- Commit the configuration.
commit
- Return to the user view.
return
- Define the traffic behavior and enable flow mirroring.
- Enter the system view.
system-view
- Configure a traffic behavior and enter the traffic behavior view.
traffic behavior behavior–name
- Enable flow mirroring.
port-mirroring enable
- (Optional) Configure the CAR rate limit for mirrored traffic.
port-mirroring car cir cir-value [ pir pir-value ] [ cbs cbs-value [ pbs pbs-value ] ]
- (Optional) Set the length of packet content to be mirrored.
port-mirroring slice-size slice-size-value
- Commit the configuration.
commit
- Return to the user view.
return
- Define a traffic policy to associate the traffic classifier with the traffic behavior.
- Enter the system view.
system-view
- Configure a traffic policy and enter the traffic policy view.
traffic policy policy-name
- Associate the traffic behavior with the traffic classifier in the traffic policy.
classifier classifier-name behavior behavior-name
- Commit the configuration.
commit