QOS 之shaping and policing

简介:

shaping and policing 针对网络拥塞所做的策略做到限速,工作的Q之前

shaping 是对超出的速率的包进行缓存,等速率降下来在发出去

只能应用在出方向,能减少TCP的重传不能making

policing是对超出的速率的包drop或者making,在出入方向都可以。

理解令牌桶的原理(token bucket):


 

BC=8000bite 速率限制在64kbs 我们求下TC=8/128=0.0625S  

一半的时间就把令牌桶沾满了,下个0.625s就没有令牌了,如果是shaping缓存,policing直接drop,从1s时间来看就有半秒时间空闲,达到限速目的。

两个令牌桶BC=BE的情况下

 

在125毫秒的时间把BC BE都占满了,到下一个65.5毫秒又把BC占满了BE还没有空闲就drop掉剩下的流量

CIR (committed information rate)承诺信息速率   bps 
Tc ( time committed)承诺时间  125毫秒   1/8秒
Bc  (brust committed)承诺的突发量   bite
Be (burst excess ) 超出的突发量
CIR=BC/Tc   在配置的时候我们只关心CIR就行了

shaping:GTS(generic traffic shaping)

                   frame relay traffic shaping

                   class-based shaping

policing   :committed  access rate   (CAR)

                  class-dased policing 

GTS:可以用在任何接口

Router(config)#int s1/0
Router(config-if)#tra
Router(config-if)#traffi
Router(config-if)#traffic-shape ?
  group  configure token bucket: group <access-list> CIR (bps) [Bc (bits) [Be
         (bits)]] 
  rate   configure token bucket: CIR (bps) [Bc (bits) [Be (bits)]]

Router(config-if)#traffic-shape ra
Router(config-if)#traffic-shape rate ?
  <8000-100000000>  Target Bit Rate (bits per second)

Router(config-if)#traffic-shape rate 64000 ?
  <0-100000000>  bits per interval, sustained
  <cr>

Router(config-if)#traffic-shape rate 64000 8000 ?
  <0-100000000>  bits per interval, excess in first interval
  <cr>

Router(config-if)#traffic-shape rate 64000 8000 8000 1000

Router#show traffic-shape

Interface   Se1/0
       Access Target    Byte   Sustain   Excess    Interval  Increment Adapt
VC     List   Rate      Limit  bits/int  bits/int  (ms)      (bytes)   Active
-             64000     2000   8000      8000      125       1000      -  

              CIR   (BC+BE)/8   BC       BE        TC         BC(8000bite/8划算成bytes)

还可以针对特定ACL来限速,但traffic-rate和traffic rate group不能同时运用在一个接口上

Router(config)#access-list 110 permit ip host 202.1.100.100 host 191.1.1.1

Router(config-if)#traffic-shape group 110 128000 8000 8000 1000

CBSHAPING就是结合MQC来做加上条命令而已

R1(config)#policy-map cbshap
R1(config-pmap)#cl
R1(config-pmap)#class TEL
R1(config-pmap-c)#sha
R1(config-pmap-c)#shape ?
  adaptive        Enable Traffic Shaping adaptation to BECN
  average         configure token bucket: CIR (bps) [Bc (bits) [Be (bits)]],
                  send out Bc only per interval
  fecn-adapt      Enable Traffic Shaping reflection of FECN as BECN
  fr-voice-adapt  Enable rate adjustment depending on voice presence
  max-buffers     Set Maximum Buffer Limit
  peak            configure token bucket: CIR (bps) [Bc (bits) [Be (bits)]],
                  send out Bc+Be per interval

R1(config-pmap-c)#shape av
R1(config-pmap-c)#shape average ?
  <8000-154400000>  Target Bit Rate (bits per second), the value needs to be
                    multiple of 8000
  percent           % of interface bandwidth for Committed information rate

R1(config-pmap-c)#shape average 64000

R1(config-pmap-c)#shape max-buffers 200

CAR:

R1(config-if)#rate-limit output ?
  <8000-2000000000>  Bits per second
  access-group       Match access list
  dscp               Match dscp value
  qos-group          Match qos-group ID

R1(config-if)#rate-limit output 256000 ?
  <1000-512000000>  Normal burst bytes

R1(config-if)#rate-limit output 256000 2000 2000 ?
  conform-action  action when rate not exceeded

R1(config-if)#rate-limit output 256000 2000 2000 con
R1(config-if)#rate-limit output 256000 2000 2000 conform-action ?
  continue                          scan other rate limits
  drop                              drop packet
  set-dscp-continue                 set dscp, scan other rate limits
  set-dscp-transmit                 set dscp and send it
  set-mpls-exp-imposition-continue  set exp during imposition, scan other rate
                                    limits
  set-mpls-exp-imposition-transmit  set exp during imposition and send it
  set-prec-continue                 rewrite packet precedence, scan other rate
                                    limits
  set-prec-transmit                 rewrite packet precedence and send it
  set-qos-continue                  set qos-group, scan other rate limits
  set-qos-transmit                  set qos-group and send it
  transmit                          transmit packet

shaping以bite为单位  policing以bity为单位

R1#show run int s1/0
Building configuration...

Current configuration : 207 bytes
!
interface Serial1/0
 no ip address
 rate-limit output 256000 2000 2000 conform-action transmit exceed-action drop

                            CIR    BC   BE

扩展:

access-list 101 permit tcp any any eq www

rate-limit output access-group 120 64000 5000 5000 conform-action transmit exceed-action drop

 rate-limit output 128000 2000 2000 conform-action continue exceed-action drop大范围

continue命令是如果第一条匹配还可以往下查

class-dased policing

拿到第一个桶令牌的是conforms

拿到第二个桶令牌的是exceed

拿不到的violate

policy-map liang
 class TEL
  police cir 64000
    conform-action transmit 
    exceed-action transmit 
    violate-action drop

 

 本文转自q狼的诱惑 51CTO博客,原文链接:http://blog.51cto.com/liangrui/552058,如需转载请自行联系原作者

 

相关文章
|
10月前
|
传感器 数据采集 物联网
MQTT 的 QoS 等级:QoS 0、QoS 1、QoS 2
MQTT 的 QoS 等级:QoS 0、QoS 1、QoS 2
976 0
|
1天前
|
Kubernetes 网络性能优化 调度
在k8S中,QoS作用是什么?
在k8S中,QoS作用是什么?
|
Java API 网络性能优化
NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
报错日志: java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy at ch.
11147 0
|
2月前
|
缓存 监控 算法
|
3月前
|
算法 搜索推荐 网络性能优化
|
算法 网络协议 网络性能优化
网络QoS
网络QoS
160 0
|
缓存 网络协议 网络性能优化
QOS(服务质量)
QOS(服务质量)
362 0
EMQ
|
存储 传感器 缓存
MQTT QoS 0, 1, 2 介绍
MQTT协议中规定了消息服务质量QoS(Quality of Service),其核心是设计了多种消息交互机制来提供不同的服务质量,来满足用户在各种场景下对消息可靠性的要求。
EMQ
1008 0
MQTT QoS 0, 1, 2 介绍
|
存储 传感器 安全
MQTT QoS 介绍
MQTT QoS 介绍
550 0
MQTT QoS 介绍
|
缓存 数据挖掘 网络性能优化
QOS技术
在晋通的网络甲,当用尸将数据发问网络设备后,网络设备都是尽最大努力传输数据,直到超出自己的最大负荷为止。当设备达到最大负荷后,如果还有用户发来的数据,那么这些数据将因为网络设备不能提供服务而被丢弃。这样的提供最大化服务的网络被称为尽力而为服务的网络。在尽力而为服务的网络中,所有的数据都被看成是同等重要的,用户的数据有时无法得到保证,所以在某些时候,必须让网络通过放弃传输相对不重要的数据来保证用户的重要数据和传输。因此,就需要在网络中实施QualityofService,即QOS。实施了QOS的网络中,可以为特定数据保证带宽,同时也可以限制宽带,可以避免网络拥塞和管理拥塞,甚至可以为数据设置不同
206 0