QoS(服務訪問質量)的配置方式(二)

因爲之前寫過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 

QoS配置實例:

QoS(服務訪問質量)的配置方式(二)
最終目的:將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技術,通過整 形後的數據流延時會變大。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章