QoS(服务访问质量)的配置方式(二)

    xiaoxiao2022-07-06  198

    因为之前写过QoS的详解与配置方式,个人感觉写的比较杂乱,自己也是属于摸着石头过河,仅仅是想借51cto博客的一亩三分地来当做自己记随手笔记的一个平台。

    所以这次好好整理了QoS的另一种配置方式,简单明了,废话不多说,配置如下(可依照此模板来配置自己所想要的效果):

    承诺访问速率与流量整 形的第二种配置:

    需要注意的是,GTS只能应用在output方向,而CAR可以应用在两个方向。

    这种配置在端口应用一种策略实施多种流量控制,和之前的标记配置类似。

    例如,某路由器的配置如下:

    R1(config)#access-list 100 permit ip any any #配置ACL R1(config)#class-map abc #配置class map R1(config-cmap)#match access-group 100 R1(config-cmap)#exit

    R1(config)#policy-map qqq #配置CAR R1(config-pmap)#class abc #引用class map R1(config-pmap-c)#police 8000 1500 1500 conform-action transmit exceed-action transmit violate-action drop #小于Bc转发,在Bc~Bc+Be之间转发,大于Bc+Be丢弃。 R1(config)#int f0/0 #在F0/0接口应用CAR策略 R1(config-if)#service-policy input qqq

    R1(config)#policy-map www #配置GTS R1(config-pmap)#class abc #引用class map R1(config-pmap-c)#shape average 8000 #配置average形式,只配置CIR

    R1(config-pmap)#in f1/0 #在F0/1接口应用GTS策略 R1(config-if)#service-policy output www 查看策略配置:

    R1#show policy-map #查看策略配置 Policy Map qqq Class abc police cir 8000 bc 1500 be 1500 #配置的速率参数 conform-action transmit #配置相应速率的action exceed-action transmit violate-action drop

    Policy Map www #策略名称 Class abc #调用的class map Traffic Shaping #流量整 形配置 Average Rate Traffic Shaping #配置的是average Rate CIR 8000 (bps) Max. Buffers Limit 1000 (Packets) #配置的速率参数 查看端口策略应用及流量信息

    R1#show policy-map interface #查看端口策略应用及流量信息 FastEthernet0/0 #端口

    Service-policy input: qqq 应用的策略与方向

    Class-map: abc (match-all) #调用的class map 0 packets, 0 bytes 5 minute offered rate 0 bps, drop rate 0 bps #转发与丢弃的流量信息 Match: access-group 100 #匹配的ACL police: cir 8000 bps, bc 1500 bytes, be 1500 bytes #应用的策略及流量配置 conformed 0 packets, 0 bytes; actions: #各部分流量的大小 transmit exceeded 0 packets, 0 bytes; actions: transmit violated 0 packets, 0 bytes; actions: drop conformed 0 bps, exceed 0 bps, violate 0 bps Class-map: class-default (match-any) #默认class map信息 0 packets, 0 bytes 5 minute offered rate 0 bps, drop rate 0 bps Match: any #匹配所有流量,即匹配其他class map之外的流量

    FastEthernet1/0

    Service-policy output: www

    Class-map: abc (match-all) 0 packets, 0 bytes 5 minute offered rate 0 bps, drop rate 0 bps Match: access-group 100 Traffic Shaping #流量整 形配置参数 Target/Average Byte Sustain Excess Interval Increment Rate Limit bits/int bits/int (ms) (bytes) 8000/8000 2000 8000 8000 1000 1000 Adapt Queue Packets Bytes Packets Bytes Shaping Active Depth Delayed Delayed Active - 0 0 0 0 0 no Class-map: class-default (match-any) 0 packets, 0 bytes 5 minute offered rate 0 bps, drop rate 0 bps Match: any

    最终目的:将PC1的流量限制在100kb/s

    方法一:使用CAR技术:

    R1(config)#access-list 100 permit ip any host 10.0.0.7 R1(config)#in f0/0 R1(config-if)#rate-limit input access-group 100 800000 20000 40000 conform-action continue exceed-action drop 配置CAR在F0/0或F1/0口都可以,需要注意input、output 方法二:使用GTS技术:

    R1(config)#access-list 101 permit ip any host 10.0.0.7 R1(config)#class-map match-all xs R1(config-cmap)#match access-group 101 R1(config-cmap)#exit R1(config)#policy-map qqq R1(config-pmap)#class xs R1(config-pmap-c)#shape average 800000 R1(config-pmap-c)#shape max-buffers 100 #定义缓冲区上限为100

    R1(config)#in f1/0 R1(config-if)#service-policy output qqq #CBWFQ(基于类的加权公平队列)只能应用在output方向,也就是说GTS要用在F1/0 两种方法根据实际情况二选一即可: 使用CAR技术,限速后的数据流会出现丢包现象; 使用GTS技术,通过整 形后的数据流延时会变大。

    最新回复(0)