The traffic-policy command applies a traffic policy to a VLAN.
The undo traffic-policy command deletes a traffic policy from a VLAN.
By default, no traffic policy is applied to a VLAN.
traffic-policy policy-name { inbound | outbound }
undo traffic-policy [ policy-name ] { inbound | outbound }
Parameter |
Description |
Value |
---|---|---|
policy-name |
Specifies the name of a traffic policy. |
The value must be the name of an existing traffic policy. |
inbound |
Applies a traffic policy to the inbound direction of a VLAN. |
- |
outbound |
Applies a traffic policy to the outbound direction of a VLAN. |
- |
Usage Scenario
Packets are classified based on Layer 2 information, Layer 3 information, or ACLs. To provide differentiated services for service flows, bind a traffic classifier and a traffic behavior to a traffic policy and apply the traffic policy. You can use the traffic-policy command to apply a traffic policy to a VLAN.
Prerequisites
A traffic policy has been created using the traffic policy command.
Precautions
After a traffic policy is applied to a VLAN, the traffic policy takes effect for packets received and sent in the VLAN.
If a traffic classifier in the traffic policy contains if-match mpls-exp, the traffic policy cannot be applied to the outbound direction on the S5720-EI, S6720-EI, and S6720S-EI.
If a traffic policy has been applied to a VLAN, you are not allowed to delete the traffic policy or its traffic classifier and traffic behavior.
After a traffic policy is applied to a VLAN, you cannot directly delete the traffic policy, the traffic classifier and traffic behavior bound to the traffic policy. In addition, you cannot modify the matching order of the rules in the traffic policy. However, you can modify the relationship between matching rules in the traffic classifier, matching rules in the traffic classifier, traffic action in the traffic behavior, and binding between the traffic classifier and the traffic behavior.
To delete the traffic policy that has been applied, run the undo traffic-policy command in the corresponding view to unbind the traffic policy and then run the undo traffic policy command in the system view to delete the traffic policy.
# Create a traffic policy p1, bind the created traffic classifier c1 and traffic behavior b1 to the traffic policy, and apply the traffic policy to the inbound direction in VLAN 100.
<HUAWEI> system-view [HUAWEI] traffic policy p1 [HUAWEI-trafficpolicy-p1] classifier c1 behavior b1 [HUAWEI-trafficpolicy-p1] quit [HUAWEI] vlan 100 [HUAWEI-vlan100] traffic-policy p1 inbound