通過Qos 策略來對P2P限速
在定義突發速率時,需要考慮一些協議(如TCP)會針對丟包而採用流控制機制。例如,TCP將把每個要丟失的數據包的窗口縮小一半,相應地,當對某個速率進行策略時,有效的鏈路使用率就會低於配置的速率。您可以增加突發速率從而實現更高的利用率。對這些流量來說,比較簡單易行的方式就是將突發速率的大小增加一倍(在我們的例子中可以從13 Kbits增加到26 Kbits),監控性能,然後根據需要進行調整。
mls qos!--- 激活 QoS mls qos flow-policing class-map match-any bit match protocol bittorrent !-匹配BT的協議 match protocol eDonkey !-匹配電騾的協議 match access-group edonkey match … !-用戶根據實際情況定義 policy-map p2p class bit !-調用 先前定義的bit 類圖 police flow 100000 2000 conform-action transmit exceed-action drop !--- 定義微流管理器,限制每個p2p應用流爲100 Kbps的微流量 police 20000000 13000 26000 conform-action transmit exceed-action drop !--- 定義聚合管理器,以便限制所有p2p應用流爲20Mbps聚合流量 |
三、在接口上應用策略(設備可能僅支持input方向)
interface gigabitEthernet0/2service-policy input p2p service-policy output p2p 如果實施基於VLAN的QoS配置,需要在二層接口配置mls qos vlan-based |
四、驗證策略實施情況
sh mls qos sh mls qos ip gigabitEthernet 0/2 sh mls ip detail #進行微流策略統計 sh int g0/2 rate-limit show policy-map interface g0/2 show ip nbar unclassified-port-stats show ip nbar protocol stats byte-count show ip nbar port-map | include custom 注:以上配置適用於cisco6509sup720平臺,可用IOS版本12.1以上。 |