萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 網路安全 >  >> 路由器知識 >> 路由器設定 >> Cisco 思科路由器

思科路由器流量限速三大技術對比:NBAR應用識別 vs 端口ACL vs Rate-Limit

針對 P2P、視頻、下載等佔用帶寬的應用,思科路由器提供三種主流限速技術。本文深度對比 NBAR 應用識別、傳統端口 ACL、CEF Rate-Limit 的原理、適用場景、配置複雜度與優缺點,助您選型部署。

一、 NBAR (Network-Based Application Recognition) 應用識別

核心優勢:

  • 深度包檢測 (DPI): 第 4-7 層特徵識別,不依賴固定端口
  • 識別加密/動態端口應用: BitTorrent (加密)、eDonkey、KaZaA、Skype、HTTP URL、DNS、VoIP (SIP/H.323)
  • PDLM 動態擴展: 通過 Packet Description Language Module 升級識別庫,無需升級 IOS

部署流程:

  1. 下載 PDLM 文件 (bittorrent.pdlm 等) 至 Flash
  2. ip nbar pdlm flash:bittorrent.pdlm 加載模塊
  3. 創建 Class Map 匹配協議:match protocol bittorrent
  4. Policy Map 定義動作:drop / police / set dscp
  5. 接口應用:service-policy input/output

配置示例:

class-map match-all bittorrent
 match protocol bittorrent
!
policy-map bittorrent-policy
 class bittorrent
  drop
!
interface FastEthernet0/0
 description Internal_LAN
 ip address 192.168.0.1 255.255.255.0
 ip nat inside
 service-policy input bittorrent-policy
 service-policy output bittorrent-policy

NBAR配置拓撲

適用場景:

  • 精準封堵/限速特定應用 (P2P、流媒體、遊戲、即時通訊)
  • 應用可視化分析 (show ip nbar protocol-discovery)
  • WAN 優化、SD-WAN 應用路由前置條件

局限:

  • 消耗 CPU/內存資源,高流量接口需評估性能影響
  • 加密流量 (TLS 1.3/QUIC/DoH) 識別能力下降,需配合 TLS 指紋/JA3/SNI 檢測
  • PDLM 更新滯後於新應用變種

二、 傳統端口 ACL + Rate-Limit

配置示例 (封鎖/限速 BT 6881-6890):

! 封鎖
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

! 限速 (需 CEF 支持)
access-list 130 remark bt
access-list 130 permit tcp any any range 6881 6890
access-list 130 permit tcp any range 6881 6890 any
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

優缺點對比:

維度端口 ACL + Rate-LimitNBAR
識別準確度低 (端口易變、衝突)高 (負載特徵)
配置複雜度低中 (需 PDLM)
性能開銷極低 (硬件轉發)中高 (軟件檢測)
加密流量支持無部分 (特徵碼)
適用設備所有支持 CEF 設備ISR/ASR 特定平台

三、 CEF Rate-Limit 接口級限速

基於令牌桶算法,對接口/子接口/VC 進行入/出方向帶寬監管。

配置步驟:

! 1. 啟用 CEF (現代 IOS 默認開啟)
ip cef

! 2. ACL 定義限速對象 (如 192.168.1.0/24)
access-list 111 permit ip 192.168.1.0 0.0.0.255 any

! 3. 接口應用 rate-limit (入方向 2Mbps)
interface FastEthernet0/1
 rate-limit input access-group 111 2000000 40000 60000 conform-action transmit exceed-action drop

適用場景:

  • 簡單的接口/子網整體帶寬限制
  • FR/ATM PVC 級別 CIR 執行
  • 不需區分應用類型的粗粒度限速

四、 綜合選型建議

業務需求推薦技術備選方案
精準識別並控制特定應用 (P2P/視頻/IM)NBAR + PDLM下一代防火牆 (NGFW) / 專用流量管理設備
簡單限制某網段/用戶總帶寬Interface Rate-Limit / PolicingMQC Policy-map police (交換機)
已知固定端口的舊應用封堵ACL + Rate-LimitNBAR (更穩健)
高性能核心鏈路 (10G+)硬件 MQC / PFC / TSN專用 QoS ASIC 平台
加密流量 (HTTPS/QUIC) 應用控制TLS 指紋/JA3/SNI 檢測設備NBAR2 (有限支持) + SSL 解密代理

五、 進階演進:CBWFQ/LLQ + Policing

生產環境建議採用 分類 + 排隊 + 監管 組合:

class-map match-any VOICE
 match protocol rtp audio
 match dscp ef
class-map match-any VIDEO
 match protocol rtp video
 match dscp af41 af42 af43
class-map match-any DATA
 match access-group 101

policy-map WAN_EDGE_QOS
 class VOICE
  priority percent 30
  police cir 2000000 bc 50000 exceed-action drop
 class VIDEO
  bandwidth percent 40
  random-detect dscp-based
 class DATA
  bandwidth percent 20
  fair-queue
  police cir 10000000 bc 200000 exceed-action drop
 class class-default
  fair-queue

interface Serial0/0
 service-policy output WAN_EDGE_QOS

結語:單一限速手段難以應對複雜業務。建議以 NBAR 做應用可視化,MQC 做分類排隊監管,NGFW 做加密流量深度檢測,構建分層流量治理體系。

copyright © 萬盛學電腦網 all rights reserved