Example for Configuring Interface-based Rate Limiting on a Fixed 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 the following products and versions:
- S2752EI, S2720-EI, S2750-EI
- S3700-SI, S3700-EI, S3700-HI
- S5700-LI, S5700S-LI, S5700-SI, S5700-EI, S5700-HI, S5710-C-LI, S5710-X-LI, S5710-EI, S5710-HI, S5720-LI, S5720S-LI, S5720-SI, S5720S-SI, S5720I-SI, S5720-EI, S5720-HI, S5730-HI, S5730-SI, S5730S-EI, S5731-H, S5731-S, S5731S-S, S5731S-H, S5732-H, S2730S-S, S5735-L-I, S5735-L1,S300, S5735-L, S5735S-L, S5735S-L1, S5735S-L-M, S5735-S, S500, S5735S-S, S5735-S-I, S5735S-H, S5736-S
- S6700-EI, S6720-LI, S6720S-LI, S6720-SI, S6720S-SI, S6720-EI, S6720S-EI, S6720-HI, S6730-H, S6730-S, S6730S-S, S6730S-H
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-252, the Switch connects to the router through GE0/0/3, and departments 1 and 2 are connected to the Switch through GE0/0/1 and GE0/0/2 respectively and access the Internet through the Switch and router.
Services are singular, and therefore 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 in the outbound direction, and department 2 requires the CIR of 5 Mbit/s in the outbound direction.
Configuration Roadmap
- Configure interfaces of the Switch so that users can access the Internet.
- Configure interface-based rate limiting on GE0/0/1 and GE0/0/2 of the Switch in the inbound direction.
Procedure
- Create VLANs and configure interfaces of the Switch.
# Create VLAN 100, VLAN 200, and VLAN 300.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan batch 100 200 300
# Configure GE0/0/1, GE0/0/2, and GE0/0/3 as trunk interfaces, and configure GE0/0/1 to allow VLAN 100, GE0/0/2 to allow VLAN 200, and GE0/0/3 to allow VLAN 100, VLAN 200, and VLAN 300.
[Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/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-GigabitEthernet0/0/1] port trunk allow-pass vlan 100 [Switch-GigabitEthernet0/0/1] quit [Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] port link-type trunk [Switch-GigabitEthernet0/0/2] port trunk allow-pass vlan 200 [Switch-GigabitEthernet0/0/2] quit [Switch] interface gigabitethernet 0/0/3 [Switch-GigabitEthernet0/0/3] port link-type trunk [Switch-GigabitEthernet0/0/3] port trunk allow-pass vlan 100 200 300 [Switch-GigabitEthernet0/0/3] quit
# Create VLANIF 300 and set its IP address to 192.168.1.1/24.
[Switch] interface vlanif 300 [Switch-Vlanif300] ip address 192.168.1.1 24 [Switch-Vlanif300] quit
On the router, set the IP address of the interface connected to the Switch to 192.168.1.2/24, and configure sub-interfaces on the interface to terminate VLANs.
- Configure interface-based rate limiting.
# Configure rate limiting on GE0/0/1 in the inbound direction and set the CIR to 8192 kbit/s.
[Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] qos lr inbound cir 8192 //Set the CIR of department 1 in the outbound direction to 8 Mbit/s. [Switch-GigabitEthernet0/0/1] quit
# Configure rate limiting on GE0/0/2 in the inbound direction and set the CIR to 5120 kbit/s.
[Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] qos lr inbound cir 5120 //Set the CIR of department 2 in the outbound direction to 5 Mbit/s. [Switch-GigabitEthernet0/0/2] quit
- Verify the configuration.
# Check the interface-based rate limiting configuration.
[Switch] display qos lr inbound interface gigabitethernet 0/0/1 GigabitEthernet0/0/1 lr inbound: cir: 8192 Kbps, cbs: 1024000 Byte
[Switch] display qos lr inbound interface gigabitethernet 0/0/2 GigabitEthernet0/0/2 lr inbound: cir: 5120 Kbps, cbs: 640000 Byte
# GE0/0/1 on models excluding S2730S-S, S5735-L-I, S5735-L1,S300, S5735-L, S5735S-L, S5735S-L1, S5735S-L-M, S5735-S, S500, S5735-S-I, and S5735S-S is used as an example. When the rate of traffic on the interface in the inbound direction is larger than 8 Mbit/s, packet loss occurs. The traffic rate is limited within 8 Mbit/s.
[Switch] display qos statistics interface gigabitethernet 0/0/1 inbound --------------------------------------------------------- Item Value --------------------------------------------------------- Passed packets 30,715 Passed bytes - Dropped packets 16,555 Dropped bytes - ---------------------------------------------------------
Configuration Files
Switch configuration file
# sysname Switch # vlan batch 100 200 300 # interface Vlanif300 ip address 192.168.1.1 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 100 qos lr inbound cir 8192 cbs 1024000 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 200 qos lr inbound cir 5120 cbs 640000 # interface GigabitEthernet0/0/3 port link-type trunk port trunk allow-pass vlan 100 200 300 # return