可以用acl和nbar技術綜合定義數據流。Acl定義可以采用下述參數:源ip地址、目的IP地址、第4層協議(如UDP)、源端口號碼以及目的端口號碼等。與一套已定義參數相匹配的數據包都被視為屬于相同的流,NBAR技術可以識別應用層流; 建立ACL用來識別p2p應用端口或者服務器ip地址,可根據實際情況配置,例如: ip access-list extended edonkey permit tcp any any range 4661 4662 permit tcp any any range 4242 4243 permit udp any any eq 4665 同時應用pdlm包 ip nbar pdlm bittorrent.pdlm ip nbar pdlm eDonkey.pdlm
mls qos !--- 激活 QoS mls qos flow-policing class-map match-any bit match PRotocol bittorrent match protocol eDonkey match access-group edonkey match … !-用戶根據實際情況定義 policy-map p2p class 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/2 service-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