萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 網路安全 >  >> 網路應用技術 >> 應用程式教學

Cisco 路由器限速實戰:NBAR 應用識別封殺 BT + ACL 埠口限速雙管齊下

不同廠牌路由器限速邏輯迥異。本文聚焦 Cisco 路由器,提供NBAR 應用識別深度封鎖 P2P與ACL 基礎埠口限速兩套互補方案。

方案一:NBAR + PDLM 精準識別並封殺 BT/電驢/Kazaa

原理: NBAR (Network-Based Application Recognition) 能動態檢測 L4-L7 協定特徵,不依賴固定埠口。PDLM (Packet Description Language Module) 為 NBAR 提供具體協定描述檔 (如 bittorrent.pdlm, emule.pdlm, kazaa2.pdlm),可從 Cisco 官網下載。

部署步驟

  1. 將 PDLM 檔透過 TFTP 複製至路由器閃存:
    copy tftp://server/bittorrent.pdlm flash:
  2. 載入 PDLM 啟用 NBAR 識別:
    ip nbar pdlm flash:bittorrent.pdlm
  3. 建立類別映射匹配協定:
    class-map match-all bittorrent
    match protocol bittorrent
  4. 建立策略映射動作 (丟棄/限速):
    policy-map bittorrent-policy
    class bittorrent
    drop (或 police 限速)
  5. 套用至 WAN 介面 (輸入/輸出):
    interface FastEthernet0/0
    service-policy input bittorrent-policy
    service-policy output bittorrent-policy

同樣適用於企業專線 WAN 介面,保障關鍵業務頻寬。

方案二:ACL 埠口範圍限速 (適用已知固定埠口應用)

BT 傳統使用 6881-6890 埠口範圍。雖新版 BT 客戶端多動態隨機埠,但結合 NBAR 可形成纵深防禦。

封鎖下載 (拒絕轉發)

access-list 130 deny tcp any any range 6881 6890
access-list 130 deny tcp any range 6881 6890 any
interface FastEthernet0/0
 ip access-group 130 in
 ip access-group 130 out

限速 (CAR - Committed Access Rate)

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
! 限制為 712kbps (約 700Kbps),突發 8000 bytes
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

最佳實踐建議

  • NBAR 為主,ACL 為輔: NBAR 捕捉動態埠/加密流量,ACL 處理已知固定埠,纵深防禦。
  • 定期更新 PDLM: 關注 Cisco 官網新協定定義檔。
  • 監控與調優: show policy-map interface 觀察匹配統計,根據實際流量調整限速閾值。
  • 內網同樣適用: 核心交換機/路由器同樣可部署,保障骨幹頻寬合理分配。

掌握 Cisco NBAR + ACL 組合拳,讓頻寬管理從「堵」轉向「疏」,精準保障業務體驗。

copyright © 萬盛學電腦網 all rights reserved