As shown in Figure 1, the Switch connects to the router through GE0/0/3. Enterprise departments 1 and 2 are connected to GE0/0/1 and GE0/0/2 of the Switch and access the Internet through the Switch and router.
Services do not need to be differentiated, but bandwidth for departments 1 and 2 needs to be limited. For departments 1, incoming traffic must be allocated guaranteed bandwidth of 8 Mbit/s. For departments 2, incoming traffic must be allocated guaranteed bandwidth of 5 Mbit/s.
# Create VLAN 100 and VLAN 200.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan batch 100 200
# 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 and VLAN 200.
[Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] port link-type 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 [Switch-GigabitEthernet0/0/3] quit
# Set the CIR for incoming traffic on GE0/0/1 to 8192 kbit/s.
[Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] qos lr inbound cir 8192 [Switch-GigabitEthernet0/0/1] quit
# Set the CIR for incoming traffic on GE0/0/2 to 5120 kbit/s.
[Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] qos lr inbound cir 5120 [Switch-GigabitEthernet0/0/2] quit
# View 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
Switch configuration file
# sysname Switch # vlan batch 100 200 # 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 # return