华为设备配置QOS接口限速(华为路由器如何对IP限速配置)

2022-08-18 21:32:43

接口限速简介
接口限速对通过整个端口的全部报文流量速率进行限制,不对具体流量进行区分,可以实现给某个接口分配固定的带宽,控制方式单一,配置简单。
入方向与出方向的接口限速属于并列关系,用户可以根据需要同时配置,也可以单独配置。
组网需求
如图1所示,Switch通过接口GE0/0/3与路由器互连,企业部门1和企业部门2通过接口GE0/0/1和GE0/0/2接入Switch,经由Switch和路由器访问网络。
由于业务较单一,不需要对业务进行区分,但是网络带宽有限,因此需要对企业各个部门的接入带宽进行整体限制。要求企业部门1出方向保证带宽为8Mbit/s;企业部门2出方向保证带宽为5Mbit/s。
图1 接口限速配置组网图


配置思路
采用如下的思路配置接口限速:

  • 配置Switch的各接口,使用户能够访问网络。
  • 在Switch接口GE0/0/1和GE0/0/2的入方向配置接口限速。


操作步骤
创建VLAN并配置Switch各接口
# 创建VLAN100、VLAN200和VLAN300。
system-view
[HUAWEI] sysname Switch
[Switch] vlan batch 100 200 300
# 将接口GE0/0/1、GE0/0/2和GE0/0/3的接入类型均配置为trunk,并配置GE0/0/1允许VLAN100通过,配置GE0/0/2允许VLAN200通过,配置GE0/0/3允许VLAN100、VLAN200和VLAN300通过。
[Switch] interface gigabitethernet 0/0/1
[Switch-GigabitEthernet0/0/1] port link-type trunk //设置接口链路类型为trunk,接口缺省链路类型不是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
# 创建VLANIF300,并配置网段地址192.168.1.1/24。
[Switch] interface vlanif 300
[Switch-Vlanif300] ip address 192.168.1.1 24
[Switch-Vlanif300] quit 说明:
请在Router上的与Switch对接的接口上配置IP地址192.168.1.2/24,并在该接口上配置子接口终结VLAN。
配置接口限速
# 在接口GE0/0/1的入方向上配置接口限速,保证带宽为8192kbit/s。
[Switch] interface gigabitethernet 0/0/1
[Switch-GigabitEthernet0/0/1] qos lr inbound cir 8192 //配置企业部门1出方向保证带宽为8Mbit/s
[Switch-GigabitEthernet0/0/1] quit
# 在接口GE0/0/2的入方向上配置接口限速,保证带宽为5120kbit/s。
[Switch] interface gigabitethernet 0/0/2
[Switch-GigabitEthernet0/0/2] qos lr inbound cir 5120 //配置企业部门2出方向保证带宽为5Mbit/s
[Switch-GigabitEthernet0/0/2] quit
验证配置结果
# 查看接口限速的配置信息。
[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的配置文件
#
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