The port shaping command sets a shaping rate for data to be sent by an interface.
The undo port shaping command cancels the configuration.
By default, the shaping rate of an interface equals the bandwidth of the interface.
port shaping { shaping-value | shaping-percentage shaping-percentage-value } [ network-header-length network-header-length-value ] [ pbs pbs-value ] [ weight-mode ]
undo port shaping
undo port shaping shaping-percentage shaping-percentage-value [ network-header-length network-header-length-value ] [ pbs pbs-value ] [ weight-mode ]
Parameter | Description | Value |
---|---|---|
shaping-value |
Specifies a shaping rate. A shaping rate indicates the peak information bandwidth of a traffic shaping-capable interface. The value is equal to the PIR. |
The value is an integer ranging from 1 to 4294967294, in Mbit/s. The maximum value cannot exceed the interface bandwidth. The value can be a string of 256K or 512K , in bit/s. |
shaping-percentage shaping-percentage-value |
Specifies the shaping rate percentage. This parameter is not supported in the tunnel interface view. |
The value is an integer ranging from 1 to 100, in percentage. |
network-header-length network-header-length-value |
Specifies the adjustment length of a service template. The device adds packet headers of different lengths to packets of different types. Therefore, enable the device to offset the length of actual packets to the desired one to allow rate limit to take effect. This parameter is not supported in the tunnel interface view. |
The value is an integer that ranges from -63 to 63. The value of this parameter must be calculated theoretically based on different service types. If the bandwidth error is in the allowed range, this parameter does not need to be specified. This value can be determined based on the rule: The larger value indicates the lower actual transmission of the interface, and the smaller value indicates the higher actual transmission of the interface. The default compensation value contains the interframe gap (IFG) and preamble. If the compensation value does not need to contain the IFG or preamble, set the length to 0. |
pbs pbs-value |
Specifies a cache size, namely, the maximum volume of traffic that a traffic shaping-capable interface can send. The value of this parameter is equal to the peak burst size (PBS). |
The value is an integer that ranges from 1 to 2147483646, in bytes. |
weight-mode |
To configure the system to allocate the shaping value based on the weight of member interfaces. This parameter can be configured only in the trunk view. |
- |
Usage Scenario
A typical application of traffic shaping is to control the volume and burst of outgoing traffic based on the network connection. Traffic shaping enables packets to be transmitted at a uniform rate.
A traffic shaping-enabled device buffers nonconforming packets and send them evenly under the control of the token bucket. Traffic shaping reduces the number of packets to be dropped. To configure the system to allocate the shaping value based on the weight of trunk member interfaces, run the port shaping [ weight-mode ] command in the trunk interface view. The weight of trunk member interfaces is specified using the distribute-weight command. For example, a trunk interface has two member interfaces. If the traffic shaping value of the trunk interface is set to 500 Mbit/s and the weight ratio of the two member interfaces is 4:1, the traffic shaping values of the two member interface are 400 Mbit/s and 100 Mbit/s, respectively. The trunk interface bandwidth is 500 Mbit/s in this case.Prerequisites
Interface bandwidth has been configured.
Configuration Impact
The interface on which the port shaping command is run shapes traffic based on configured interface bandwidth.
Precautions
If shaping-percentage is specified in the command, the command is applied only to physical main interfaces, trunk interfaces.
If a multiple member interfaces of a trunk interface reside on different forwarding or traffic management modules, the effective shaping value for port-queue or port-shaping can be a multiple of the configured one. port shaping shaping-value [ weight-mode ] and port shaping { shaping-value | shaping-percentage shaping-percentage-value }[ network-header-length network-header-length ] [ pbs pbs-value ] , qos port-shaping member-link-scheduler distribute, qos default user-queue commands are mutually exclusive. This command is supported on a tunnel interface only when the protocol of the tunnel interface is set to GRE or GRE IPv6. In multi-VS scenarios, after this command is configured on a trunk main interface, the command configuration is also effective for the trunk sub-interfaces that reside in other VSs.<HUAWEI> system-view [~HUAWEI] interface Tunnel 10 [~HUAWEI-Tunnel10] tunnel-protocol gre [~HUAWEI-Tunnel10] port shaping 500
<HUAWEI> system-view [~HUAWEI] interface eth-trunk 1 [~HUAWEI-Eth-Trunk1] port shaping 500 weight-mode
<HUAWEI> system-view [~HUAWEI] interface GigabitEthernet0/1/0 [~HUAWEI-GigabitEthernet0/1/0] port shaping 500