The traffic-policy command applies a traffic policy to an interface.
The undo traffic-policy command deletes a traffic policy from an interface.
By default, no traffic policy is applied to an interface.
traffic-policy policy-name { inbound | outbound }
undo traffic-policy [ policy-name ] { inbound | outbound }
Traffic policies can be applied to only the inbound direction of sub-interfaces on the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S.
Only the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S support Ethernet sub-interfaces.
After you run the undo portswitch command to switch Layer 2 interfaces on the preceding series of switches into Layer 3 interfaces, you can configure Ethernet sub-interfaces on the interfaces.
After an interface is added to an Eth-Trunk, sub-interfaces cannot be configured on the interface.
Parameter |
Description |
Value |
---|---|---|
policy-name |
Specifies the name of a user-defined traffic policy. |
The value must be the name of an existing traffic policy. When double quotation marks are used around the string, spaces are allowed in the string. The value cannot be f, fa, fas , fast, fast-, fast-m, fast-mo, fast-mod, or fast-mode. |
inbound |
Applies a traffic policy to the inbound direction. |
- |
outbound |
Applies a traffic policy to the outbound direction. |
- |
Ethernet interface view, MultiGE interface view, GE interface view, XGE interface view, 25GE interface view, 40GE interface view, 100GE interface view, Eth-Trunk interface view, GE sub-interface view, XGE sub-interface view, 25GE sub-interface view, MultiGE sub-interface view, 40GE sub-interface view, 100GE sub-interface view, Eth-Trunk sub-interface view, port group view
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 created traffic policy to an interface.
Prerequisites
A traffic policy has been created using the traffic policy command, and traffic classifiers and traffic behaviors have been bound to the traffic policy.
Precautions
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.
Only one traffic policy can be applied to each 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, 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.
If the traffic policy that you want to delete has been applied to an interface, run the undo traffic-policy command to unbind the traffic policy from the interface. Then run the undo traffic policy command in the system view to delete the traffic policy.
Run the undo traffic-policy { inbound | outbound } command without policy-name specified to delete the traffic policy that has been applied to an interface and has the following names: i, in, inb, inbo, inbou, inboun, inbound, o, ou, out, outb, outbo, outbou, outboun, and outbound.
# 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 on GE0/0/1.
<HUAWEI> system-view [HUAWEI] traffic policy p1 [HUAWEI-trafficpolicy-p1] classifier c1 behavior b1 [HUAWEI-trafficpolicy-p1] quit [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] traffic-policy p1 inbound