Configuring MQC-based VLAN Mapping
Context
A traffic policy is a QoS policy configured by binding traffic classifiers to traffic behaviors. A traffic policy is bound to a traffic classifier and traffic behavior to implement VLAN mapping. The traffic classifier defines rules based on VLAN IDs. VLAN mapping based on the traffic policy implements differentiated services.
Procedure
- Configure a traffic classifier.
Run:
system-view
The system view is displayed.
Run:
traffic classifier classifier-name [ operator { and | or } ] [ precedence precedence-value ]
A traffic classifier is created and the traffic classifier view is displayed, or the existing traffic classifier view is displayed.
and is the logical operator between the rules in the traffic classifier, which means that:If the traffic classifier contains ACL rules, packets match the traffic classifier only when they match one ACL rule and all the non-ACL rules.
If the traffic classifier does not contain any ACL rules, packets match the traffic classifier only when they match all the rules in the classifier.
By default, the relationship between rules in a traffic classifier is OR.
- Configure matching rules according to the following table.
The if-match ip-precedence and if-match tcp commands are only valid for IPv4 packets.
X series cards do not support traffic classifiers with advanced ACLs containing the ttl-expired field or user-defined ACLs.
When a traffic classifier contains if-match ipv6 acl { acl-number | acl-name }, X series cards do not support add-tag vlan-id vlan-id, remark 8021p [ 8021p-value | inner-8021p ], remark cvlan-id cvlan-id, remark vlan-id vlan-id, or mac-address learning disable.
Run:
quit
Exit from the traffic classifier view.
- Configure a traffic behavior.
Run:
traffic behavior behavior-name
A traffic behavior is created and the traffic behavior view is displayed.
Run:
remark vlan-id vlan-id3
The traffic behavior is configured. The outer VLAN ID of the packet is re-marked.
(Optional) Run:
remark cvlan-id vlan-id4
The traffic behavior is configured. The inner VLAN ID of the packet is re-marked.
Run:
quit
Exit from the traffic behavior view.
Run:
quit
Exit from the system view.
- Configure a traffic policy.
Run:
traffic policy policy-name [ match-order { auto | config } ]
A traffic policy is created and the traffic policy view is displayed, or the view of an existing traffic policy is displayed. If you do not specify a matching order for traffic classifiers in the traffic policy, the default matching order config is used.
After a traffic policy is applied, you cannot use the traffic policy command to change the matching order of traffic classifiers in the traffic policy. To change the matching order, delete the traffic policy and create a traffic policy with the required matching order.
When creating a traffic policy, you can specify the matching order of traffic classifiers in the traffic policy. The traffic classifiers can be matched in automatic order (auto) or configuration order (config):- If the matching order is auto, traffic classifiers are matched in descending order of priorities pre-defined in the system: traffic classifiers based on Layer 2 and Layer 3 information, traffic classifiers based on Layer 2 information, and finally traffic classifiers based on Layer 3 information. If a data flow matches multiple traffic classifiers that are associated with conflicting traffic behavior, the traffic behavior associated with the traffic classifier of the highest priority takes effect.
- If the matching order is config, traffic classifiers are matched in descending order of priorities either manually or dynamically allocated to them. This is determined by the precedence value; a traffic classifier with a smaller precedence value has a higher priority and is matched earlier. If you do not specify precedence-value when creating a traffic classifier, the system allocates a precedence value to the traffic classifier. The allocated value is [(max-precedence + 5)/5] x 5, where max-precedence is the greatest value among existing traffic classifiers.
If more than 128 rate limiting ACL rules are configured in the system, traffic policies must be applied to the interface view, VLAN view, and system view in sequence. To update an ACL rule, delete all the associated traffic policies from the interface, VLAN, and system. Then, reconfigure the traffic policies and reapply them to the interface, VLAN, and system.
Run:
classifier classifier-name behavior behavior-name
A traffic behavior is bound to a traffic classifier in the traffic policy.
Run:
quit
Exit from the traffic policy view.
Run:
quit
Exit from the system view.
- Apply the traffic policy.
- Applying a traffic policy to an interface
Run:
system-view
The system view is displayed.
Run:
interface interface-type interface-number
The interface view is displayed.
Run:
traffic-policy policy-name { inbound | outbound }
A traffic policy is applied to the interface.
A traffic policy can be applied to only one direction on an interface, but a traffic policy can be applied to different directions on different interfaces. After a traffic policy is applied to an interface, the system performs traffic policing for all the incoming or outgoing packets that match traffic classification rules on the interface.
- Applying a traffic policy to a VLAN
Run:
system-view
The system view is displayed.
Run:
vlan vlan-id
The VLAN view is displayed.
Run:
traffic-policy policy-name { inbound | outbound }
A traffic policy is applied to the VLAN.
Only one traffic policy can be applied to a VLAN in the inbound or outbound direction.
After a traffic policy is applied, the system performs traffic policing for the packets that belong to a VLAN and match traffic classification rules in the inbound or outbound direction. However, the traffic policy does not take effect for packets in VLAN 0.
- Applying a traffic policy to the system or an LPU
Run:
system-view
The system view is displayed.
Run:
traffic-policy policy-name global { inbound | outbound } [ slot slot-id ]
A traffic policy is applied to the system or an LPU.
Only one traffic policy can be applied to the system or LPU in one direction. A traffic policy cannot be applied to the same direction in the system and on the LPU simultaneously.
- Applying a traffic policy to an interface