Traffic shaping adjusts the rate of outgoing traffic to ensure even transmission. Traffic shaping uses the buffer and token bucket to control traffic. When packets are sent at a high rate, traffic shaping caches packets in the buffer and then evenly sends these cached packets based on the token bucket.
Traffic shaping is often configured on the downstream device to prevent packet loss caused by congestion. For example, the headquarters connects to its branch through a leased line that has finite bandwidth. Traffic policing is configured on the headquarters edge device to limit the packet sending rate. In this situation, traffic shaping can be configured on the branch edge device to cache excess packets, preventing packet loss.
For applicable product models and versions, see Applicable Product Models and Versions.
For details about software mappings, visit Hardware Query Tool and search for the desired product model.
In Figure 1, the Switch is connected to the router through GE2/0/1. The 802.1p priorities of voice, video, and data services are 6, 5, and 2, respectively, and these services can reach residential users through the router and Switch. The transmission rate of traffic from the user LAN is higher than the transmission rate of traffic from the router; therefore, jitter may occur on GE2/0/1. To prevent jitter and ensure bandwidth of services, ensure that:
The CIR of the interface is 10000 kbit/s.
The CIR and PIR for the voice service are 3000 kbit/s and 5000 kbit/s respectively.
The CIR and PIR for the video service are 5000 kbit/s and 8000 kbit/s respectively.
The CIR and PIR for the data service are 2000 kbit/s and 3000 kbit/s respectively.
Create VLANs and configure interfaces so that users can access the Internet through the Switch.
Configure priority mapping to map 802.1p priorities of different service packets to PHBs.
Configure traffic shaping on an interface to limit the total bandwidth of the interface.
Configure traffic shaping on queues of the interface to limit the bandwidth of voice, video, and data services.
# Create VLAN 10.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan batch 10
# Configure GE1/0/1 and GE2/0/1 as trunk interfaces and add them to VLAN 10.
[Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] port link-type trunk [Switch-GigabitEthernet1/0/1] port trunk allow-pass vlan 10 [Switch-GigabitEthernet1/0/1] quit [Switch] interface gigabitethernet 2/0/1 [Switch-GigabitEthernet2/0/1] port link-type trunk [Switch-GigabitEthernet2/0/1] port trunk allow-pass vlan 10 [Switch-GigabitEthernet2/0/1] quit
# Create VLANIF 10 and set its IP address to 10.10.10.2/24.
[Switch] interface vlanif 10 [Switch-Vlanif10] ip address 10.10.10.2 255.255.255.0 [Switch-Vlanif10] quit
On the router, set the IP address of the interface connected to the Switch to 10.10.10.1/24, and configure a sub-interface on the interface to terminate the VLAN.
# Create a DiffServ domain ds1 to map 802.1p priorities 6, 5, and 2 to PHBs CS7, EF, and AF2 respectively.
[Switch] diffserv domain ds1 [Switch-dsdomain-ds1] 8021p-inbound 6 phb cs7 //Map 802.l priorities in different service flows to PHBs so that the service flows enter different queues. [Switch-dsdomain-ds1] 8021p-inbound 5 phb ef [Switch-dsdomain-ds1] 8021p-inbound 2 phb af2 [Switch-dsdomain-ds1] quit [Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] trust upstream ds1 [Switch-GigabitEthernet1/0/1] quit
# Configure traffic shaping on an interface of the Switch to limit the CIR of the interface to 10000 kbit/s.
[Switch] interface gigabitethernet 2/0/1 [Switch-GigabitEthernet2/0/1] qos lr cir 10000 outbound //Configure interface-based rate limiting in the outbound direction to limit the total bandwidth.
# Configure traffic shaping on queues of the interface on the Switch to set the CIR values of voice, video, and data services to 3000 kbit/s, 5000 kbit/s, and 2000 kbit/s respectively and their PIR values to 5000 kbit/s, 8000 kbit/s, and 3000 kbit/s respectively.
[Switch-GigabitEthernet2/0/1] qos queue 7 shaping cir 3000 pir 5000 //Set the bandwidth of voice packets entering queue 7 to 3000 kbit/s according to the default mapping between PHBs and local priorities. [Switch-GigabitEthernet2/0/1] qos queue 5 shaping cir 5000 pir 8000 [Switch-GigabitEthernet2/0/1] qos queue 2 shaping cir 2000 pir 3000 [Switch-GigabitEthernet2/0/1] quit [Switch] quit
# Check the configuration of the DiffServ domain ds1.
<Switch> display diffserv domain name ds1 diffserv domain name:ds1 8021p-inbound 0 phb be green 8021p-inbound 1 phb af1 green 8021p-inbound 2 phb af2 green 8021p-inbound 3 phb af3 green 8021p-inbound 4 phb af4 green 8021p-inbound 5 phb ef green 8021p-inbound 6 phb cs7 green 8021p-inbound 7 phb cs7 green 8021p-outbound be green map 0 ......
# After the configuration is complete, the CIR of packets sent from GE2/0/1 is 10000 kbit/s; the CIR of the voice service packets is 3000 kbit/s and PIR is 5000 kbit/s; the CIR of the video service packets is 5000 kbit/s and the PIR is 8000 kbit/s; the CIR of the data service packets is 2000 kbit/s and the PIR is 3000 kbit/s.
Switch configuration file
#
sysname Switch
#
vlan batch 10
#
diffserv domain ds1
8021p-inbound 6 phb cs7 green
#
interface Vlanif10
ip address 10.10.10.2 255.255.255.0
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk allow-pass vlan 10
trust upstream ds1
#
interface GigabitEthernet2/0/1
port link-type trunk
port trunk allow-pass vlan 10
qos lr cir 10000 cbs 1250000 outbound
qos queue 2 shaping cir 2000 pir 3000
qos queue 5 shaping cir 5000 pir 8000
qos queue 7 shaping cir 3000 pir 5000
#
return
Product |
Product Model |
Software Version |
---|---|---|
S5700 |
S5700-HI |
V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00SPC500&C01&C02) |
S5710-EI |
V200R001C00, V200R002C00, V200R003C00, V200R005(C00&C02) |
|
S5720-EI |
V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10 |
|
S5710-HI |
V200R003C00, V200R005(C00&C02&C03) |
|
S5720-HI |
V200R006C00, V200R007(C00&C10), V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10 |
|
S5730-HI |
V200R012C00, V200R013C00, V200R019C00, V200R019C10 |
|
S5731-H |
V200R013C02, V200R019C00, V200R019C10 |
|
S5731-S, S5731S-S |
V200R019C00, V200R019C10 |
|
S5731S-H |
V200R019C00, V200R019C10 |
|
S5732-H |
V200R019C00, V200R019C10 |
|
S6700 |
S6700-EI |
V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00&C01&C02) |
S6720-EI |
V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10 |
|
S6720S-EI |
V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10 |
|
S6720-HI |
V200R012C00, V200R013C00, V200R019C00, V200R019C10 |
|
S6730-H |
V200R013C02, V200R019C00, V200R019C10 |
|
S6730-S, S6730S-S |
V200R019C00, V200R019C10 |
|
S6730S-H |
V200R019C10 |
|
S7700 |
S7703, S7706, S7712 |
V200R001(C00&C01), V200R002C00, V200R003C00, V200R005C00, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00, V200R013C02, V200R019C00, V200R019C10 |
S7703 PoE |
V200R013C00, V200R019C00, V200R019C10 |
|
S7706 PoE |
V200R013C00, V200R019C00, V200R019C10 |
|
S9700 |
S9703, S9706, S9712 |
V200R001(C00&C01), V200R002C00, V200R003C00, V200R005C00, V200R006C00, V200R007(C00&C10), V200R008C00, V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00 |