僅支援 Cisco Express Forwarding (CEF) 的路由器/交換機才能使用 rate-limit 進行流量控制。
| 參數 | 說明 |
|---|---|
input | output | 流量方向:入向或出向介面 |
bps | 速率上限,單位 bps(位元/秒) |
burst-normal | 正常突發桶大小,單位 Bytes,建議 8000/16000/32000 |
burst-max | 最大突發桶大小,單位 Bytes |
conform-action | 符合速率流量動作(如 transmit 轉發) |
exceed-action | 超速流量動作(如 drop 丟棄、set-prec-transmit 重標記) |
interface GigabitEthernet0/0
rate-limit input 2000000 16000 32000 conform-action transmit exceed-action drop
rate-limit output 2000000 16000 32000 conform-action transmit exceed-action drop
說明:
- 2,000,000 bps = 2 Mbps
- 正常桶 16000 Bytes,最大桶 32000 Bytes,允許短時突發
- 符合轉發,超速丟棄
show interfaces rate-limit 查看計數器與違規統計access-list 可針對特定流量(如 HTTP、P2P)分類限速注意:rate-limit 屬舊版 QoS(CAR),新平台建議採用 MQC(Modular QoS CLI)配置 policy-map 實現更精細的流量整形與佇列管理。