Example for Configuring Interface-based Rate Limiting on a Modular Switch
Overview
Interface-based rate limiting is easy to configure and limits the rate of all packets sent or received on an interface regardless of packet type. An interface enabled with this function can be assigned fixed bandwidth.
Interface-based rate limiting in the inbound and outbound directions can be configured simultaneously or separately.
Configuration Notes
- This example applies to all modular switch models and versions.
For the product models whose applicable versions are not listed above, see Table 3-1 in "Applicable Products and Versions" for details.
To view detailed information about software mappings, visit Info-Finder, select a product series or product model, and click Hardware Center.
Networking Requirements
In Figure 3-253, the Switch connects to the router through GE2/0/1, and departments 1 and 2 are connected to the Switch through GE1/0/1 and GE1/0/2 respectively and access the Internet through the Switch and router.
Only data services are transmitted on the network, so services do not need to be differentiated. With finite network bandwidth, bandwidth of each department needs to be limited. Department 1 requires the CIR of 8 Mbit/s and PIR of 10 Mbit/s, and department 2 requires the CIR of 5 Mbit/s and PIR of 8 Mbit/s.
Configuration Roadmap
- Create VLANs and configure interfaces so that users can access the Internet through the Switch.
- Create different CAR profiles and configure the CIRs and PIRs in the CAR profiles, and apply the CAR profiles to GE1/0/1 and GE1/0/2 on the Switch in the inbound direction to limit the rate of packets from different departments.
Procedure
- Create VLANs and configure interfaces of the Switch.
# Create VLAN 100 and VLAN 200.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan batch 100 200
# Configure GE1/0/1, GE1/0/2, and GE2/0/1 as trunk interfaces, and add GE1/0/1 to VLAN 100, GE1/0/2 to VLAN 200, and GE2/0/1 to VLAN 100 and VLAN 200.
[Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] port link-type trunk //Set the link type of the interface to trunk. The default link type of the interface is not trunk. [Switch-GigabitEthernet1/0/1] port trunk allow-pass vlan 100 [Switch-GigabitEthernet1/0/1] quit [Switch] interface gigabitethernet 1/0/2 [Switch-GigabitEthernet1/0/2] port link-type trunk [Switch-GigabitEthernet1/0/2] port trunk allow-pass vlan 200 [Switch-GigabitEthernet1/0/2] quit [Switch] interface gigabitethernet 2/0/1 [Switch-GigabitEthernet2/0/1] port link-type trunk [Switch-GigabitEthernet2/0/1] port trunk allow-pass vlan 100 200 [Switch-GigabitEthernet2/0/1] quit
- Configure CAR profiles.
# Create CAR profiles car1 and car2 on the Switch to limit the rate of traffic from departments 1 and 2.
[Switch] qos car car1 cir 8192 pir 10240 //Set the CIR to 8 Mbit/s and PIR to 10 Mbit/s in the CAR profile car1. [Switch] qos car car2 cir 5120 pir 8192 //Set the CIR to 5 Mbit/s and PIR to 8 Mbit/s in the CAR profile car2.
- Apply the CAR profiles.
# Apply the CAR profiles to GE1/0/1 and GE1/0/2 on the Switch in the inbound direction respectively to limit the rate of traffic from departments 1 and 2.
[Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] qos car inbound car1 [Switch-GigabitEthernet1/0/1] quit [Switch] interface gigabitethernet 1/0/2 [Switch-GigabitEthernet1/0/2] qos car inbound car2 [Switch-GigabitEthernet1/0/2] quit [Switch] quit
- Verify the configuration.
# Check the CAR profile configuration.
<Switch> display qos car all ---------------------------------------------------------------- CAR Name : car1 CAR Index : 0 car cir 8192 (Kbps) pir 10240 (Kbps) cbs 1024000 (byte) pbs 1280000 (byte) ---------------------------------------------------------------- CAR Name : car2 CAR Index : 1 car cir 5120 (Kbps) pir 8192 (Kbps) cbs 640000 (byte) pbs 1024000 (byte)
# Send traffic at rates of 6000 kbit/s, 9000 kbit/s, and 11000 kbit/s to GE1/0/1 and GE1/0/2, and run the display qos car statistics command to view traffic statistics. When packets are sent to GE1/0/1 and GE1/0/2 at a rate of 6000 kbit/s, all packets are forwarded. When packets are sent to GE1/0/1 and GE1/0/2 at a rate of 9000 kbit/s, all packets on GE1/0/1 are forwarded and some packets on GE1/0/2 are discarded. When packets are sent to GE1/0/1 and GE1/0/2 at a rate of 11000 kbit/s, some packets on both GE1/0/1 and GE1/0/2 are discarded.
Configuration Files
Switch configuration file
#
sysname Switch
#
vlan batch 100 200
#
qos car car1 cir 8192 pir 10240 cbs 1024000 pbs 1280000
qos car car2 cir 5120 pir 8192 cbs 640000 pbs 1024000
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk allow-pass vlan 100
qos car inbound car1
#
interface GigabitEthernet1/0/2
port link-type trunk
port trunk allow-pass vlan 200
qos car inbound car2
#
interface GigabitEthernet2/0/1
port link-type trunk
port trunk allow-pass vlan 100 200
#
return