Example for Configuring Interface-based Rate Limiting
Networking Requirements
As shown in Figure 5-10, a tenant server sends traffic through SwitchA and the Switch and connects to the external network through the egress router.
The rate of packets sent from the tenant server cannot exceed 100 Mbit/s.
Configuration Roadmap
- Configure interfaces on the Switch to implement network connectivity.
- Create a CAR profile and set the CIR.
- Apply the CAR profile to 10GE1/0/1 in the inbound direction on the Switch to limit the traffic rate on the interface within the allowed range.
Procedure
- Create a VLAN and configure interfaces on the Switch.
# Create VLAN 100 on the Switch.
<HUAWEI> system-view [~HUAWEI] sysname Switch [*HUAWEI] commit [~Switch] vlan 100 [*Switch-vlan100] quit [*Switch] commit
# Configure 10GE1/0/1 and 10GE1/0/2 on the Switch as trunk interfaces and add them to VLAN 100.
[~Switch] interface 10ge 1/0/1 [~Switch-10GE1/0/1] port link-type trunk [*Switch-10GE1/0/1] port trunk allow-pass vlan 100 [*Switch-10GE1/0/1] quit [*Switch] interface 10ge 1/0/2 [*Switch-10GE1/0/2] port link-type trunk [*Switch-10GE1/0/2] port trunk allow-pass vlan 100 [*Switch-10GE1/0/2] quit [*Switch] commit
- Configure a CAR profile.
# Create a CAR profile car1 on the Switch to limit the rate of traffic from the tenant server.
[~Switch] qos car car1 cir 100000 [*Switch] commit
- Apply the CAR profile.
# Apply the CAR profile car1 in the inbound direction of 10GE1/0/1 on the Switch to limit traffic from the tenant server.
[~Switch] interface 10ge 1/0/1 [~Switch-10GE1/0/1] qos car inbound car1 [*Switch-10GE1/0/1] quit [*Switch] commit
- Verify the configuration.
# View the CAR profile configuration.
[~Switch] display qos car car1 ---------------------------------------------------------------- CAR Name : car1 CAR Index : 0 car cir 100000 kbps cbs 800000 bytes Applied number on behavior : 0 Applied number on interface inbound : 1 10GE1/0/1 Applied number on Eth-Trunk inbound : 0
# Send traffic to 10GE1/0/1 at the rates of 60000 kbit/s and 110000 kbit/s, and run the display qos car statistics command to check the QoS CAR statistics. If the configuration is successful, you can obtain the following results:- When packets are sent to 10GE1/0/1 at a rate of 60000 kbit/s, all the packets are forwarded.
- When packets are sent to 10GE1/0/1 at a rate of 110000 kbit/s, some packets are discarded.