Example for Configuring Traffic Shaping
Networking Requirements
As shown in Figure 3-9, voice, video, and data services are deployed on the LAN of an enterprise. The service traffic is transmitted to Eth2/0/0 of RouterA through the switch, and then to the WAN through GE3/0/0 of RouterA.
- The CIR on GE3/0/0 is 8000 kbit/s.
- The CIR and CBS for the voice service are 256 kbit/s and 6400 bytes respectively.
- The CIR and CBS for the video service are 4000 kbit/s and 100000 bytes respectively.
- The CIR and CBS for the data service are 2000 kbit/s and 50000 bytes respectively.
Configuration Roadmap
- Create VLANs and VLANIF interfaces on RouterA and configure physical interfaces to ensure that enterprise users can access the WAN through RouterA.
- Configure the inbound interface of service packets on RouterA to trust 802.1p priorities in packets.
- Configure interface-based traffic shaping on the inbound interface of service packets on RouterA to limit the interface bandwidth.
- Configure queue-based traffic shaping on RouterA to limit the bandwidth of voice, video, and data services.
Procedure
- Configure VLANs and interfaces.
# Create VLAN 10 on RouterA.
<Router> system-view [Router] sysname RouterA [RouterA] vlan 10 [RouterA-vlan10] quit
# Configure Eth2/0/0 as a trunk interface and add it to VLAN 10.
[RouterA] interface ethernet 2/0/0 [RouterA-Ethernet2/0/0] port link-type trunk [RouterA-Ethernet2/0/0] port trunk allow-pass vlan 10 [RouterA-Ethernet2/0/0] quit
Configure the interface on the switch connected to RouterA as a trunk interface and add it to VLAN 10.
# Create VLANIF 10 and assign IP address 192.168.1.1/24 to VLANIF 10.
[RouterA] interface vlanif 10 [RouterA-Vlanif10] ip address 192.168.1.1 24 [RouterA-Vlanif10] quit
# Set the IP address of GE3/0/0 to 192.168.4.1/24.
[RouterA] interface gigabitethernet 3/0/0 [RouterA-GigabitEthernet3/0/0] ip address 192.168.4.1 24 [RouterA-GigabitEthernet3/0/0] quit
Configure RouterB and ensure that there are reachable routes between RouterB and RouterA.
- Configure the packet priority trusted by the inbound interface of packets.
# Configure Eth2/0/0 to trust 802.1p priorities of packets.
[RouterA] interface ethernet 2/0/0 [RouterA-Ethernet2/0/0] trust 8021p [RouterA-Ethernet2/0/0] quit
- Configure interface-based traffic shaping.
# Configure traffic shaping on GE3/0/0 of RouterA to limit the traffic rate on the interface to 8000 kbit/s.
[RouterA] interface gigabitethernet 3/0/0 [RouterA-GigabitEthernet3/0/0] qos gts cir 8000 [RouterA-GigabitEthernet3/0/0] quit
- Configure queue-based traffic shaping.
# Create a queue profile qp1 on RouterA, set the scheduling mode to WFQ for queues 0 to 5 and to PQ for queue 6 and queue 7. Set CIR values for queue 6, queue 5, and queue 2 to 256 kbit/s, 4000 kbit/s, and 2000 kbit/s respectively, and set CBS values for queue 6, queue 5, and queue 2 to 6400 bytes, 100000 bytes, and 50000 bytes respectively.
[RouterA] qos queue-profile qp1 [RouterA-qos-queue-profile-qp1] schedule pq 6 to 7 wfq 0 to 5 [RouterA-qos-queue-profile-qp1] queue 6 gts cir 256 cbs 6400 [RouterA-qos-queue-profile-qp1] queue 5 gts cir 4000 cbs 100000 [RouterA-qos-queue-profile-qp1] queue 2 gts cir 2000 cbs 50000 [RouterA-qos-queue-profile-qp1] quit
# Apply the queue profile qp1 to GE3/0/0 on RouterA.
[RouterA] interface gigabitethernet 3/0/0 [RouterA-GigabitEthernet3/0/0] qos queue-profile qp1
- Verify the configuration.
# View the configuration of GE3/0/0 on RouterA.
[RouterA-GigabitEthernet3/0/0] display this # interface GigabitEthernet3/0/0 ip address 192.168.4.1 255.255.255.0 qos queue-profile qp1 qos gts cir 8000 # return
# View the queue profile configuration.
[RouterA-GigabitEthernet3/0/0] quit [RouterA] display qos queue-profile qp1 Queue-profile: qp1 Queue Schedule Weight Length(Bytes/Packets) GTS(CIR/CBS) ----------------------------------------------------------------- 0 WFQ 10 -/- -/- 1 WFQ 10 -/- -/- 2 WFQ 10 -/- 2000/50000 3 WFQ 10 -/- -/- 4 WFQ 10 -/- -/- 5 WFQ 10 -/- 4000/100000 6 PQ - -/- 256/6400 7 PQ - -/- -/-
Configuration Files
- RouterA configuration file
# sysname RouterA # vlan batch 10 # qos queue-profile qp1 queue 2 gts cir 2000 cbs 50000 queue 5 gts cir 4000 cbs 100000 queue 6 gts cir 256 cbs 6400 schedule wfq 0 to 5 pq 6 to 7 # interface Vlanif10 ip address 192.168.1.1 255.255.255.0 # interface Ethernet2/0/0 port link-type trunk port trunk allow-pass vlan 10 trust 8021p # interface GigabitEthernet3/0/0 ip address 192.168.4.1 255.255.255.0 qos queue-profile qp1 qos gts cir 8000 # return