思科企業級路由器提供 ACL、Rate-limit、NBAR/PDLM 多層次流控手段,可精準識別並限制/封鎖 P2P 流量。以下為實戰配置指南。
! 定義 BT 常用埠 6881-6890
access-list 130 remark BT_Traffic
access-list 130 permit tcp any any range 6881 6890
access-list 130 permit tcp any range 6881 6890 any
! 輸入/輸出方向套用 Rate-limit (CIR 712kbps, Bc 8000, Be 8000)
rate-limit input access-group 130 712000 8000 8000 conform-action transmit exceed-action drop
rate-limit output access-group 130 712000 8000 8000 conform-action transmit exceed-action drop
缺點: 現代 BT 客戶端動態換埠(8000、8080、2070 等),靜態 ACL 無法有效覆蓋。
access-list 130 deny tcp any any range 6881 6890
access-list 130 deny tcp any range 6881 6890 any
ip access-group 130 in
ip access-group 130 out
同樣受限於埠號變動,且封鎖常用埠(80/443/8080)會誤傷正常業務。
NBAR (Network-Based Application Recognition) 能深度檢測 L4-L7 協議特徵,不依賴埠號。PDLM (Packet Description Language Module) 為協議特徵庫檔案。
bittorrent.pdlm、kazaa2.pdlm、emonkey.pdlm)。copy tftp://server/bittorrent.pdlm flash:bittorrent.pdlmip nbar pdlm flash:bittorrent.pdlmclass-map match-all BITTORRENT
match protocol bittorrentpolicy-map BITTORRENT_POLICY
class BITTORRENT
police cir 512000 bc 8000 be 8000 conform-action transmit exceed-action drop
! 或直接 dropinterface FastEthernet0/0
description WAN_Link
ip address 192.168.0.1 255.255.255.0
ip nat inside
service-policy input BITTORRENT_POLICY
service-policy output BITTORRENT_POLICY掌握 ACL→Rate-limit→NBAR/PDLM 進階路徑,即可應對從簡單埠號封鎖到複雜應用識別的各類流控需求。