引用:
Enter the following commands while configuring a class-based QoS policy to create a class map that
identifies and classifies BitTorrent file transfer traffic:
class-map [match-any | match-all] class-map-name
match protocol bittorrent
配置:
本例在cisco3640路由器中封杀bt和edondey,其它路由器也一样。
IOS版本:c3640-io3-mz.123-14.T2.bin
1、把bittorrent.pdlm和eDonkey.pdlm文件传到路由器flash中(或slot或disk)。
2、在路由器中配置:
cisco3640#conf t
cisco3640(config)#ip nbar pdlm flash:bittorrent.pdlm ;加载flash中的bittorrent.pdlm到IOS软件中。
cisco3640(config)#ip nbar pdlm flash:eDonkey.pdlm ;加载flash中的eDonkey.pdlm到IOS软件中。
% NBAR ERROR : newer version of PDL module `edonkey' already loaded (2 >= 2) ;说明IOS软件已经带有eDonkey.pdlm模块了。
cisco3640(config)#class-map match-any bit-eDonkey ;定义class-map名。注意要用match-any,因为要封掉bittorrent或edonkey(or关系),match-all(and关系)
cisco3640(config-cmap)#match protocol bittorrent ;选择bittorrent协议
cisco3640(config-cmap)#match protocol edonkey ;选择edonkey协议
cisco3640(config)#policy-map drop-bit-edon ;定义policy-map名
cisco3640(config-pmap)#class bit-eDonkey ;class class-map
cisco3640(config-pmap-c)#drop ;丢弃BT和eDonkey数据
cisco3640(config)#int fastEthernet 3/1 ;选择配置端口,进入端口配置模式
cisco3640(config-if)#service-policy input drop-bit-edon ;应用policy-map为流入数据方式。
cisco3640(config-if)#service-policy output drop-bit-edon ;应用policy-map为流出数据方式。其实到上一条就可以了。
==========================
conf文件相关部分内容:
!
ip nbar pdlm flash:bittorrent.pdlm
!
!
!
class-map match-any bit-eDonkey
match protocol bittorrent
match protocol edonkey
!
!
policy-map drop-bit-edon
class bit-eDonkey
drop
!
!
!
interface FastEthernet3/1
ip address xxx.xxx.xxx.xxx 255.255.255.252
duplex auto
speed auto
service-policy input drop-bit-edon
service-policy output drop-bit-edon
!