針對 P2P、視頻、下載等佔用帶寬的應用,思科路由器提供三種主流限速技術。本文深度對比 NBAR 應用識別、傳統端口 ACL、CEF Rate-Limit 的原理、適用場景、配置複雜度與優缺點,助您選型部署。
bittorrent.pdlm 等) 至 Flaship nbar pdlm flash:bittorrent.pdlm 加載模塊match protocol bittorrentdrop / police / set dscpservice-policy input/outputclass-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

show ip nbar protocol-discovery)! 封鎖
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-Limit | NBAR |
|---|---|---|
| 識別準確度 | 低 (端口易變、衝突) | 高 (負載特徵) |
| 配置複雜度 | 低 | 中 (需 PDLM) |
| 性能開銷 | 極低 (硬件轉發) | 中高 (軟件檢測) |
| 加密流量支持 | 無 | 部分 (特徵碼) |
| 適用設備 | 所有支持 CEF 設備 | ISR/ASR 特定平台 |
基於令牌桶算法,對接口/子接口/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
| 業務需求 | 推薦技術 | 備選方案 |
|---|---|---|
| 精準識別並控制特定應用 (P2P/視頻/IM) | NBAR + PDLM | 下一代防火牆 (NGFW) / 專用流量管理設備 |
| 簡單限制某網段/用戶總帶寬 | Interface Rate-Limit / Policing | MQC Policy-map police (交換機) |
| 已知固定端口的舊應用封堵 | ACL + Rate-Limit | NBAR (更穩健) |
| 高性能核心鏈路 (10G+) | 硬件 MQC / PFC / TSN | 專用 QoS ASIC 平台 |
| 加密流量 (HTTPS/QUIC) 應用控制 | TLS 指紋/JA3/SNI 檢測設備 | NBAR2 (有限支持) + SSL 解密代理 |
生產環境建議採用 分類 + 排隊 + 監管 組合:
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 做加密流量深度檢測,構建分層流量治理體系。