Applying the Traffic Policy
Pre-configuration Tasks
A traffic policy can be applied to the system, a VLAN, and an interface. When a traffic policy needs to be applied in multiple views, apply the traffic policy in the interface view, VLAN view, and system view in sequence.
Procedure
- 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.
Only 2700-52P-EI, S2700-52P-PWR-EI, S2710-SI and S3700 support tunnel interface.
- Run the following command based
on the device model to apply the traffic policy to an interface.
On S2700EI models except S2700-52P-EI and S2700-52P-PWR-EI, run the traffic-policy policy-name { inbound | outbound } command to apply the traffic policy to the interface.
On S2700EI models except S2700-52P-EI and S2700-52P-PWR-EI, a traffic policy can be applied in the outbound direction only when flow mirroring is configured in the traffic behavior of the traffic policy. That is, the outbound traffic policy supports only flow mirroring. Before configuring flow mirroring, run the observe-port (local mirroring) or observe-port (remote mirroring) command to configure an observing port.
On the S2700-52P-EI, S2700-52P-PWR-EI, S2710SI, S3700SI, and S3700EI, run the traffic-policy policy-name inbound command to apply the traffic policy to the interface.
Each direction on an interface can be configured with only one traffic policy. A single traffic policy can be applied to both directions on one or more interfaces. After a traffic policy is applied to an interface, the system performs traffic policing for all the incoming or outgoing packets that match rules in a traffic classifier on the interface.
Do not apply the traffic policy containing remark 8021p or remark vlan-id to the outbound direction on an interface added to a VLAN in untagged mode; otherwise, the packet content may be incorrect.
- 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
A traffic policy is applied to the VLAN.
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 direction. However, the traffic policy does not take effect for packets in VLAN 0.
- Applying a traffic policy globally