中文
登录
交换机
园区网交换机
数据中心与云计算交换机
行业精选交换系列
工业交换机
SDN
配件
所有技术解决方案
路由器
核心路由器
汇聚路由器
接入路由器
移动路由器
行业精选路由器系列
无线
放装型无线接入点
墙面型无线接入点
智分无线接入点
室外无线接入点
场景化无线
无线控制器
行业精选无线系列
无线管理与应用
云桌面
云终端系列
云主机系列
云桌面软件系列
配件系列
服务产品
安全
大数据安全平台
下一代防火墙
安全网关
检测管理安全
安全服务
安全云
所有技术解决方案
软件
身份管理
安全管理系列
运营管理系列
身份中台
所有技术解决方案
服务产品
基础实施服务
基础维护服务
运维管理服务
整网服务
安全服务
备件与扩容服务
培训与认证服务
官方商城
尊龙时凯睿易
体验中心
尊龙时凯AI应用
网络研讨会
首页 >服务与支持 >常见问题 >Qos是什么,如何配置?
QoS(Quality of Service,服务质量)能够满足用户对不同应用不同服务质量的要求。根据用户的要求分配和调度资源,对不同的报文提供不同的服务质量。
在传统的IP网络中,设备对所有的报文都采用等同对待方式,按照报文到达的时间先后,先入先出的排队策略(FIFO)处理,尽最大的努力(Best-Effort)将报文传送到目的地。当网络带宽充裕的时候,所有的报文都得到了较好的处理;而当网络发生拥塞的时候,所有的报文都有可能被丢弃。
QoS针对某种类别的报文,可以为它赋予某个级别的传输优先级,标识它的相对重要性,并使用设备所提供的各种优先级转发策略、拥塞避免等机制为这些报文提供特殊的传输服务。对实时性强且重要的报文优先处理;对于实时性不强的普通报文,提供较低的处理优先级,网络拥塞时甚至丢弃。
QoS增加了网络性能的可预知性,并能够有效地分配网络带宽,更加合理地利用网络资源。
某学校为了满足正常的教学业务需要,要求满足以下四点需求:
l 限制学校访问Internet的流量为100Mbps,丢弃超出限制的报文。
l 限制宿舍楼的出口流量为50Mbps,丢弃超出限制的报文。
l 限制实验楼发出DSCP优先级为7的报文的速率为20Mbps,将速率超过20M的此类报文丢弃。
l 限制教学楼的出口流量为30Mbps,丢弃超出限制的报文。
说明
某学校通过Device A的G0/24上联Internet,Device A的G0/1、G0/2和G0/3分别下联的教学楼(192.168.194.2~253/24)、实验楼(192.168.195.2~253/24)和宿舍楼(192.168.196.2~253/24)。
图1-6 接口限速和优先级重标记应用场景
(1) 对于出口访问Internet,在Device A接口G0/24上配置接口的出口流量限制,带宽限制为每秒102400KBits,突发流量限制为每秒256Kbytes。
(2) 对于宿舍楼,在Device A接口G0/3上配置接口的入口流量限制,带宽限制为每秒51200KBits,突发流量限制为每秒256Kbytes。
(3) 对于教学楼,在Device A接口G0/1上配置接口的入口流量限制,带宽限制为每秒30720KBits,突发流量限制为每秒256Kbytes。
(4) 对于实验楼,创建类cmap_dscp7匹配DSCP优先级7,创建策略pmap_shiyan,关联cmap_dscp7,绑定流行为,将速度超过20M的报文的DSCP值改为16;将pmap_shiyan应用在接口G0/2上,并配置接口信任DSCP。
(1) 配置接口IP地址(略)。
(2) 配置接口限速。
# 对于出口访问Internet,在接口G0/24上配置接口的出口流量限制。
DeviceA> enable
DeviceA# configure terminal
DeviceA(config)# interface gigabitethernet 0/24
DeviceA(config-if-GigabitEthernet 0/24# rate-limit output 102400 256
DeviceA(config-if-GigabitEthernet 0/24)# exit
# 对于宿舍楼,在接口G0/3上配置接口的入口流量限制。
DeviceA(config)# interface gigabitethernet 0/3
DeviceA(config-if-GigabitEthernet 0/3# rate-limit input 51200 256
DeviceA(config-if-GigabitEthernet 0/3)# exit
# 对于教学楼,在接口G0/1上配置接口的入口流量限制。
DeviceA(config)# interface gigabitethernet 0/1
DeviceA(config-if-GigabitEthernet 0/1# rate-limit input 30720 256
DeviceA(config-if-GigabitEthernet 0/1)# exit
(3) 配置流分类。
# 对于实验楼,配置类,流行为和策略。
DeviceA(config)# class-map cmap_dscp7
DeviceA(config-cmap)# match ip dscp 7
DeviceA(config-cmap)# exit
DeviceA(config)# policy-map pmap_shiyan
DeviceA(config-pmap)# class cmap_dscp7
DeviceA(config-pmap-c)# police 20480 128 exceed-action drop
DeviceA(config-pmap-c)# exit
DeviceA(config-pmap)# exit
# 将策略应用到接口,并配置接口信任DSCP。
DeviceA(config)# interface gigabitethernet 0/2
DeviceA(config-if-GigabitEthernet 0/2# service-policy input pmap_shiyan
DeviceA(config-if-GigabitEthernet 0/2)# mls qos trust dscp
DeviceA(config-if-GigabitEthernet 0/2)# exit
# 检查接口限速配置是否成功。
DeviceA# show mls qos rate-limit
Interface: GigabitEthernet 0/1
rate limit input Kbps = 30720 burst = 256
Interface: GigabitEthernet 0/3
rate limit input Kbps = 51200 burst = 256
Interface: GigabitEthernet 0/24
rate limit output Kbps = 102400 burst = 256
# 检查类是否创建成功。
DeviceA# show class-map cmap_dscp7
Class Map cmap_dscp7
Match ip dscp 7
# 检查策略是否创建成功。
DeviceA# show policy-map pmap_shiyan
Policy Map pmap_shiyan
Class cmap_dscp7
police 20480 128 exceed-action dscp 16
# 检查策略是否成功应用在接口上。
DeviceA# show mls qos interface gigabitethernet 0/2
Interface: GigabitEthernet 0/2
Ratelimit input:
Ratelimit output:
Attached input policy-map: pmap_shiyan
Attached output policy-map:
Default trust: dscp
Default cos: 0
Device A的配置文件
hostname DeviceA
!
class-map cmap_dscp7
match ip dscp 7
!
policy-map pmap_shiyan
class cmap_dscp7
police 20480 128 exceed-action drop
!
interface GigabitEthernet 0/1
ip add 192.168.194.1 255.255.255.0
rate-limit input 30720 256
!
interface GigabitEthernet 0/2
ip add 192.168.195.1 255.255.255.0
service-policy input pmap_shiyan
mls qos trust dscp
!
interface GigabitEthernet 0/3
ip add 192.168.196.1 255.255.255.0
rate-limit input 51200 256
!
interface GigabitEthernet 0/24
rate-limit output 102400 256
!
配置优先级重标记和队列调度,实现下述需求:
l 当研发部和市场部访问服务器时,服务器报文的优先级为:邮件服务器>文件服务器>工资查询服务器。
l 无论人事管理部访问Internet或访问服务器,Device A都优先处理。
l Device A在运行过程中,时常发现网络拥塞。为了保证业务顺利运转,要求使用WRR队列调度,对研发部和市场部访问邮件数据库、访问文件数据库、访问工资查询数据库的IP数据报按照6:2:1的比例来调度。
说明
研发部(192.168.45.2~253/24)、市场部(192.168.46.2~253/24)和人事管理部(192.168.47.2~253/24)分别接入Device A的接口G0/1、G0/2和G0/3;工资查询服务器(192.168.10.2/24)、邮件服务器(192.168.10.3/24)和文件服务器(192.168.10.4/24)连接在Device A的接口G0/23。
图1-7 队列调度和拥塞避免应用场景
(1) 在Device A上创建访问各类服务器的ACL,并创建类匹配这些ACL。
(2) 创建策略,关联各个类,为访问各类服务器的报文重新指定802.1p。访问邮件服务器的报文重新指定802.1p为4,访问文件服务器的报文重新指定802.1p为3,访问工资查询服务器的报文重新制定802.1p为2。并将其关联到研发部和市场部的入口上,配置接口信任802.1p。
(3) 配置人事管理部接口的802.1p为最高优先级7,优先保障人事部发出的报文。
(4) 配置队列的输出调度策略为WRR,轮转权重为1:1:1:2:6:1:1:0,即对人事管理部报文实行SP调度,对研发部与市场部访问邮件数据库、文件数据库、工资查询数据库的报文按照6:2:1的比例来调度。
(5) 开启WRED功能。
(6) 配置接口G0/2队列2的低门限为10 20。
(7) 配置接口G0/2队列2的高门限为60 90。
(8) 配置接口G0/2队列2的最大丢弃概率60 80。
(1) 在Device A上配置访问各类服务器的ACL和对应规则。
# 配置访问工资查询服务器的ACL和对应规则。
DeviceA> enable
DeviceA# configure terminal
DeviceA(config)# ip access-list extended salary
DeviceA(config-ext-nacl)# permit ip any host 192.168.10.2
DeviceA(config-ext-nacl)# exit
# 配置访问邮件服务器的ACL和对应规则。
DeviceA(config)# ip access-list extended mail
DeviceA(config-ext-nacl)# permit ip any host 192.168.10.3
DeviceA(config-ext-nacl)# exit
# 配置访问文件服务器的ACL和对应规则。
DeviceA(config)# ip access-list extended file
DeviceA(config-ext-nacl)# permit ip any host 192.168.10.4
DeviceA(config-ext-nacl)# exit
(2) 在Device A上配置类。
# 将类salary和允许访问工资查询服务器的ACL规则关联起来。
DeviceA(config)# class-map salary
DeviceA(config-cmap)# match access-group salary
DeviceA(config-cmap)# exit
# 将类mail和允许访问邮件服务器的ACL规则关联起来。
DeviceA(config)# class-map mail
DeviceA(config-cmap)# match access-group mail
DeviceA(config-cmap)# exit
# 将类file和允许访问文件服务器的ACL规则关联起来。
DeviceA(config)# class-map file
DeviceA(config-cmap)# match access-group file
DeviceA(config-cmap)# exit
(3) 在Device A上配置策略。
# 配置访问服务器的策略toserver。
DeviceA(config)# policy-map toserver
DeviceA(config-pmap)#
# 将类salary和对应的流行为关联起来。
DeviceA(config-pmap)# class salary
DeviceA(config-pmap-c)# set cos 2
DeviceA(config-pmap-c)# exit
# 将类mail和对应的流行为关联起来。
DeviceA(config-pmap)# class mail
DeviceA(config-pmap-c)# set cos 4
DeviceA(config-pmap-c)# exit
# 将类file和对应的流行为关联起来。
DeviceA(config-pmap)# class file
DeviceA(config-pmap-c)# set cos 3
DeviceA(config-pmap-c)# exit
DeviceA(config-cmap)# exit
(4) 在Device A上应用策略。
# 在接入研发部的接口上应用策略。
DeviceA(config)# interface gigabitethernet 0/1
DeviceA(config-if-GigabitEthernet 0/1)# service-policy input toserver
DeviceA(config-if-GigabitEthernet 0/1)# mls qos trust cos
DeviceA(config-if-GigabitEthernet 0/1)# exit
# 在接入市场部的接口上应用策略。
DeviceA(config)# interface gigabitethernet 0/2
DeviceA(config-if-GigabitEthernet 0/2)# service-policy input toserver
DeviceA(config-if-GigabitEthernet 0/2)# mls qos trust cos
DeviceA(config-if-GigabitEthernet 0/2)# exit
(5) 在Device A上配置接口的802.1p。
# 配置人事管理部接口的802.1p为最高优先级。
DeviceA(config)# interface gigabitethernet 0/3
DeviceA(config-if-GigabitEthernet 0/3)# mls qos cos 7
DeviceA(config-if-GigabitEthernet 0/3)# exit
(6) 在Device A上配置队列的输出调度策略。
# 配置队列的输出调度策略为WRR。
DeviceA(config)# wrr-queue bandwidth 1 1 1 2 6 1 1 0
DeviceA(config)# mls qos scheduler wrr
(7) 在Device A上配置拥塞避免。
# 开启WRED功能。
DeviceA(config)# queueing wred
# 配置高低门限和最大丢弃概率。
DeviceA(config)# interface gigabitethernet 0/2
DeviceA(config-if-GigabitEthernet 0/2)# wrr-queue random-detect min-threshold 2 10 20
DeviceA(config-if-GigabitEthernet 0/2)# wrr-queue random-detect max-threshold 2 60 90
DeviceA(config-if-GigabitEthernet 0/2)# wrr-queue random-detect probability 2 60 80
# 配置内部服务类别与门限的映射。
DeviceA(config-if-GigabitEthernet 0/2)# wrr-queue cos-map 2 0 1 2 3
DeviceA(config-if-GigabitEthernet 0/2)# exit
# 检查ACL是否创建成功。
DeviceA# show access-lists
ip access-list extended file
10 permit ip any host 192.168.10.4
ip access-list extended mail
10 permit ip any host 192.168.10.3
ip access-list extended salary
10 permit ip any host 192.168.10.2
# 检查类是否成功关联ACL。
DeviceA# show class-map
Class Map salary
Match access-group salary
Class Map mail
Match access-group mail
Class Map file
Match access-group file
# 检查策略是否创建成功,类与流行为是否绑定成功。
DeviceA# show policy-map
Policy Map toserver
Class mail
set cos 4
Class file
set cos 3
Class salary
set cos 2
# 检查策略是否成功应用在接口GigabitEthernet 0/1上。
DeviceA# show mls qos interface gigabitethernet 0/1
Interface: GigabitEthernet 0/1
Ratelimit input:
Ratelimit output:
Attached input policy-map: toserver
Attached output policy-map:
Default trust: cos
Default cos: 0
# 检查策略是否成功应用在接口GigabitEthernet 0/2上。
DeviceA# show mls qos interface gigabitethernet 0/2
Interface: GigabitEthernet 0/2
Ratelimit input:
Ratelimit output:
Attached input policy-map: toserver
Attached output policy-map:
Default trust: cos
Default cos: 0
# 检查策略是否成功应用在接口GigabitEthernet 0/3上。
DeviceA# show mls qos interface gigabitethernet 0/3
Interface: GigabitEthernet 0/3
Ratelimit input:
Ratelimit output:
Attached input policy-map:
Attached output policy-map:
Default trust: none
Default cos: 7
# 检查接口的802.1p是否配置成功,调度策略与轮转权重是否配置成功。
DeviceA# show mls qos queueing
Cos-queue map:
cos qid
--- ---
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
wrr bandwidth weights:
qid weights
--- -------
1 1
2 1
3 1
4 2
5 6
6 1
7 1
8 0
drr bandwidth weights:
qid weights
--- -------
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
wfq bandwidth weights:
qid weights
--- -------
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
Device A的配置文件
hostname DeviceA
!
wrr-queue bandwidth 1 1 1 2 6 1 1 0
queueing wred
wrr-queue cos-map 2 0 1 2 3
!
class-map salary
match access-group salary
class-map mail
match access-group mail
class-map file
match access-group file
!
policy-map toserver
class salary
set cos 2
class mail
set cos 4
class file
set cos 3
!
interface GigabitEthernet 0/1
ip add 192.168.45.1 255.255.255.0
service-policy input toserver
mls qos trust cos
!
interface GigabitEthernet 0/2
ip add 192.168.46.1 255.255.255.0
wrr-queue random-detect min-threshold 2 10 20
service-policy input toserver
mls qos trust cos
!
interface GigabitEthernet 0/3
ip add 192.168.47.1 255.255.255.0
mls qos cos 7
!