The car command configures traffic policing in a traffic behavior.
The undo car command deletes traffic policing from a traffic behavior.
By default, traffic policing is not configured in a traffic behavior.
car [ aggregation ] cir cir-value [ pir pir-value ] [ cbs cbs-value pbs pbs-value ] [ share ] [ green pass ] [ yellow { discard | pass [ remark-dscp dscp-value | remark-8021p 8021p-value ] } ] [ red { discard | pass [ remark-dscp dscp-value | remark-8021p 8021p-value ] } ] (S2720-EI, S5720I-SI, S5720-LI, S5720S-LI, S5720S-SI, S5720-SI, S5730S-EI, S5730-SI, S6720-LI, S6720S-LI, S6720S-SI, and S6720-SI)
car cir cir-value [ pir pir-value ] [ cbs cbs-value pbs pbs-value ] [ share ] [ green { discard | pass [ remark-dscp dscp-value | remark-8021p 8021p-value ] } ] [ yellow { discard | pass [ remark-dscp dscp-value | remark-8021p 8021p-value ] } ] [ red { discard | pass [ remark-dscp dscp-value | remark-8021p 8021p-value ] } ](S5720-EI, S6720-EI, and S6720S-EI)
car cir cir-value [ pir pir-value ] [ cbs cbs-value pbs pbs-value ] [ share ] [ green { discard | pass [ service-class class color color ] } | yellow { discard | pass [ service-class class color color ] } | red { discard | pass [ service-class class color color ] } ]* (S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-HI, S6730-H, S6730S-H, S6730-S, and S6730S-S)
car [ aggregation ] cir cir-value [ pir pir-value ] [ cbs cbs-value pbs pbs-value ] [ share ] [ green { discard | pass [ remark-dscp dscp-value ] } ] [ yellow { discard | pass [ remark-dscp dscp-value ] } ] [ red { discard | pass [ remark-dscp dscp-value ] } ] (S5735-L, S5735S-L, S5735S-L-M, S5735-S, S5735-S-I, and S5735S-S)
undo car
Parameter |
Description |
Value |
---|---|---|
aggregation |
Indicates aggregated CAR. Aggregated CAR can be applied to multiple interfaces, and traffic on the interfaces is restricted by aggregated CAR. |
- |
cir cir-value |
Specifies the committed information rate (CIR), which is the allowed rate at which traffic can pass through. |
The value is an integer that ranges from 8 to 4294967295, in kbit/s. NOTE:
On the S5735-L, S5735S-L, S5735S-L-M, S5735-S, S5735-S-I, and S5735S-S, the minimum CIR is 16 kbit/s. |
pir pir-value |
Specifies the peak information rate (PIR), which is the maximum rate at which traffic can pass through. |
The value is an integer that ranges from 8 to 4294967295, in kbit/s. NOTE:
On the S5735-L, S5735S-L, S5735S-L-M, S5735-S, S5735-S-I, and S5735S-S, the minimum PIR is 16 kbit/s. The PIR must be greater than or equal to the CIR. The default PIR is equal to the CIR. |
cbs cbs-value |
Specifies the committed burst size (CBS), which is the average volume of burst traffic that can pass through an interface. |
The value is an integer that ranges from 4000 to 4294967295, in bytes. The default CBS is 125 times the CIR. NOTE:
If the default CBS is smaller than 4000 because the CIR is small, the device uses the CBS of 4000. If the default CBS is larger than 4294967295 because the CIR is large, the device uses the CBS of 4294967295. |
pbs pbs-value |
Specifies the peak burst size (PBS), which is the maximum volume of burst traffic that can pass through an interface. |
The value is an integer that ranges from 4000 to 4294967295, in bytes. If the PIR is not set, the default PBS is 125 times the CIR. If the PIR is set, the default PBS is 125 times the PIR. NOTE:
If the default PBS is smaller than 4000 because the CIR or PIR is small, the device uses the PBS of 4000. If the default PBS is larger than 4294967295 because the CIR or PIR is large, the device uses the PBS of 4294967295. |
share |
Indicates level-1 aggregated CAR. If level-1 aggregated CAR is defined in a traffic behavior, and a traffic classifier defining multiple matching rules is bound to this traffic behavior, traffic matching the traffic classifier shares the CIR. |
- |
green yellow red |
Specifies the packet color. The packet color is determined by cbs cbs-value and pbs pbs-value of this command. By default, green packets and yellow packets are allowed to pass through, and red packets are discarded. |
- |
discard |
Discards packets. |
If the action specified for green packets is discard, the action specified for yellow and red packets must be discard. If the action specified for yellow packets is discard, the action specified for red packets must be discard. |
pass |
Allows packets to pass through. |
- |
remark-8021p 8021p-value |
Re-marks the 802.1p priorities of packets. |
The value is an integer that ranges from 0 to 7. A larger value indicates a higher priority. |
remark-dscp dscp-value |
Re-marks the DSCP priority of packets. |
The value is an integer that ranges from 0 to 63. |
service-class class |
Specifies the class of service (CoS). |
The value can be af1, af2, af3, af4, be, cs6, cs7, or ef. |
color color |
Specifies the color corresponding to the CoS. |
The value can be green, yellow, or red. |
Usage Scenario
Flow-based traffic policing controls traffic that matches traffic classification rules and discards the excess traffic to limit traffic within a proper range and to protect network resources.
When data is sent from a high-speed link to a low-speed link, the bandwidth on the interface of the low-speed link is insufficient. As a result, a large number of packets are discarded. To solve this problem, configure traffic policing for outgoing traffic on the interface of the high-speed link. The interface then discards the packets whose rate exceeds the traffic policing rate so that the outgoing traffic rate is limited within a proper range. You can also configure traffic policing for incoming traffic on the interface of the low-speed link. The interface then discards the received packets whose rate exceeds the traffic policing rate.
Traffic policing based on traffic policies controls rates of packets of different types.
After traffic policing is configured, the device counts forwarded and discarded packets.
Prerequisites
A traffic behavior has been created using the traffic behavior command.
Precautions
When a traffic policy containing traffic policing actions is applied to an interface, you must use the undo traffic-policy command to unbind the traffic policy if you need to change traffic policing parameters.
If a traffic behavior defines the car command with remark-8021p 8021p-value or remark-dscp dscp-value specified on the S2720-EI, S5720I-SI, S5720-LI, S5720S-LI, S5720S-SI, S5720-SI, S5730S-EI, S5730-SI, S6720-LI, S6720S-LI, S6720S-SI, and S6720-SI, a traffic policy containing this traffic behavior can only be applied in the inbound direction.
If aggregated CAR is configured by specifying the aggregation parameter on the S2720-EI, S5720I-SI, S5720-LI, S5735-L, S5735S-L, S5735S-L-M, S5720S-LI, S5720S-SI, S5720-SI, S5735-S, S5735S-S, S5735-S-I, S5730S-EI, S5730-SI, S6720-LI, S6720S-LI, S6720S-SI, and S6720-SI, the traffic policies containing this traffic behavior can only be applied in the inbound direction.
If a traffic behavior defines the car command with share specified, a traffic policy containing this traffic behavior can only be applied in the inbound direction.
The aggregation and share parameters cannot be specified simultaneously in one traffic behavior.
For the S2720-EI, S5720I-SI, S5720-LI, S5735-L, S5735S-L, S5735S-L-M, S5720S-LI, S5720S-SI, S5720-SI, S5735-S, S5735S-S, S5735-S-I, S5730S-EI, S5730-SI, S6720-LI, S6720S-LI, S6720S-SI, and S6720-SI, if a traffic policy defining aggregated CAR and traffic statistics is applied to multiple interfaces, the system collects traffic statistics on all these interfaces. Traffic statistics on any one of the interfaces are the sum traffic statistics of all these interfaces.
After traffic policing is configured on an interface, the number of packets that can be forwarded on the interface every second is relevant to the packet length calculation method. By default, the device calculates the 20-byte inter-frame gap and preamble. That is, the device calculates the actual packet length plus 20-byte inter-frame gap and preamble.
When you use a traffic policy for rate limiting and apply the traffic policy in the Eth-Trunk interface view, if the Eth-Trunk interface contains several member interfaces, these member interfaces share the bandwidth specified by the rate limit.
On the S5735-L, S5735S-L, S5735S-L-M, S5735-S, S5735-S-I, and S5735S-S, if traffic policing and traffic statistics collection are configured in the same traffic behavior, only statistics on the numbers of packets and bytes that match the bound traffic classifier and on the packet rate, namely, values of Packets, Bytes, Rate(pps), and Rate(bps) in matched in the display traffic policy statistics command output, are correct.
For the S5720-EI, S6720-EI, and S6720S-EI, the car command containing remark-dscp dscp-value and the remark dscp command cannot be configured in the same traffic behavior.
For the S5735-L, S5735S-L, S5735S-L-M, S5735-S, S5735-S-I, and S5735S-S, if the car command containing remark-dscp dscp-value and the remark dscp command are configured in the same traffic behavior, only the car command takes effect after the corresponding traffic policy is applied. The re-marked DSCP priority of a packet depends on the car command setting.
<HUAWEI> system-view [HUAWEI] traffic behavior b1 [HUAWEI-behavior-b1] car cir 1000 green pass remark-8021p 7 yellow pass remark-dscp 20 red discard
<HUAWEI> system-view [HUAWEI] acl number 4999 [HUAWEI-acl-L2-4999] rule 5 permit destination-mac 0001-0001-0001 [HUAWEI-acl-L2-4999] rule 10 permit destination-mac 0002-0002-0002 [HUAWEI-acl-L2-4999] quit [HUAWEI] traffic classifier c2 operator or [HUAWEI-classifier-c2] if-match acl 4999 [HUAWEI-classifier-c2] quit [HUAWEI] traffic behavior b2 [HUAWEI-behavior-b2] car cir 100 pir 100 cbs 18800 pbs 31300 share green pass yellow pass red discard [HUAWEI-behavior-b2] quit [HUAWEI] traffic policy p2 [HUAWEI-trafficpolicy-p2] classifier c2 behavior b2 [HUAWEI-trafficpolicy-p2] quit [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] traffic-policy p2 inbound