配置流量整形示例
组网需求
Switch通过接口GE2/0/1与路由器互连,来自网络侧的业务有语音、视频、数据,携带的802.1p优先级分别为6、5、2,这些业务可经由路由器和Switch到达用户,如图4-14所示。由于来自用户局域网的流量速率大于Router接口的速率,出接口GE2/0/1处可能会发生带宽抖动。为减少带宽抖动,同时保证各类业务带宽要求,现要求如下:
接口带宽限制为10000kbit/s。
语音带宽限制为3000kbit/s,最大不超过5000kbit/s。
视频带宽限制为5000kbit/s,最大不超过8000kbit/s。
数据带宽限制为2000kbit/s,最大不超过3000kbit/s。
配置思路
创建VLAN,并配置各接口,使用户能够通过Switch访问网络。
配置优先级映射,将802.1p优先级映射为PHB行为。
配置接口整形功能,限制接口的总带宽。
配置端口队列整形功能,限制语音、视频、数据三类业务的带宽。
操作步骤
- 创建VLAN并配置各接口
# 创建VLAN 10。
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan batch 10
# 将接口GE1/0/1、GE2/0/1的接入类型分别配置为trunk,并分别将接口GE1/0/1、GE2/0/1加入VLAN 10。
[Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] port link-type trunk [Switch-GigabitEthernet1/0/1] port trunk allow-pass vlan 10 [Switch-GigabitEthernet1/0/1] quit [Switch] interface gigabitethernet 2/0/1 [Switch-GigabitEthernet2/0/1] port link-type trunk [Switch-GigabitEthernet2/0/1] port trunk allow-pass vlan 10 [Switch-GigabitEthernet2/0/1] quit
# 创建VLANIF10,并配置网段地址10.10.10.2/24。
[Switch] interface vlanif 10 [Switch-Vlanif10] ip address 10.10.10.2 255.255.255.0 [Switch-Vlanif10] quit
请在Router上的与Switch对接的接口上配置IP地址10.10.10.1/24。
- 配置优先级映射
# 创建DiffServ域ds1,将802.1p优先级6、5、2分别映射为PHB行为CS7、EF、AF2。
[Switch] diffserv domain ds1 [Switch-dsdomain-ds1] 8021p-inbound 6 phb cs7 [Switch-dsdomain-ds1] 8021p-inbound 5 phb ef [Switch-dsdomain-ds1] 8021p-inbound 2 phb af2 [Switch-dsdomain-ds1] quit [Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] trust upstream ds1 [Switch-GigabitEthernet1/0/1] quit
- 配置接口整形
# 在Switch上配置接口整形,将接口速率限制在10000kbit/s。
[Switch] interface gigabitethernet 2/0/1 [Switch-GigabitEthernet2/0/1] qos lr cir 10000 outbound
- 配置端口队列整形
# 在Switch上配置端口队列整形,使语音、视频、数据业务的带宽分别限制为3000kbit/s、5000kbit/s、2000kbit/s,最大分别不超过5000kbit/s、8000kbit/s、3000kbit/s。
[Switch-GigabitEthernet2/0/1] qos queue 7 shaping cir 3000 pir 5000 [Switch-GigabitEthernet2/0/1] qos queue 5 shaping cir 5000 pir 8000 [Switch-GigabitEthernet2/0/1] qos queue 2 shaping cir 2000 pir 3000 [Switch-GigabitEthernet2/0/1] quit [Switch] quit
- 验证配置结果
# 查看DiffServ域ds1的配置信息。
<Switch> display diffserv domain name ds1 diffserv domain name:ds1 8021p-inbound 0 phb be green 8021p-inbound 1 phb af1 green 8021p-inbound 2 phb af2 green 8021p-inbound 3 phb af3 green 8021p-inbound 4 phb af4 green 8021p-inbound 5 phb ef green 8021p-inbound 6 phb cs7 green 8021p-inbound 7 phb cs7 green 8021p-outbound be green map 0 ......
# 配置成功后,从接口GE2/0/1发出的报文带宽限制为10000kbit/s;语音业务带宽限制为3000kbit/s,不超过5000kbit/s;视频业务带宽限制为5000kbit/s,不超过8000kbit/s;数据业务带宽限制为2000kbit/s,不超过3000kbit/s。
配置文件
Switch的配置文件
# sysname Switch # vlan batch 10 # diffserv domain ds1 8021p-inbound 6 phb cs7 green # interface Vlanif10 ip address 10.10.10.2 255.255.255.0 # interface GigabitEthernet1/0/1 port link-type trunk port trunk allow-pass vlan 10 trust upstream ds1 # interface GigabitEthernet2/0/1 port link-type trunk port trunk allow-pass vlan 10 qos lr cir 10000 cbs 1250000 outbound qos queue 2 shaping cir 2000 pir 3000 qos queue 5 shaping cir 5000 pir 8000 qos queue 7 shaping cir 3000 pir 5000 # return