VyOS上的WAN負載平衡、QoS和監控
確保穩定的網際網路連接、最佳化頻寬和監控流量是重要要求。VyOS提供強大的WAN負載平衡、QoS和監控功能。
WAN負載平衡
set load-balancing wan rule 10 inbound-interface eth0
set load-balancing wan rule 10 interface eth1 weight 100
set load-balancing wan rule 10 interface eth2 weight 50
set load-balancing wan rule 10 failover
set load-balancing wan rule 10 exclude traffic source address 192.168.1.0/24
set load-balancing wan interface-health eth1 test 10 type ping target 8.8.8.8
set load-balancing wan interface-health eth2 test 10 type ping target 1.1.1.1
QoS:流量塑形和優先級
set qos policy shaper SHAPER bandwidth 100mbit
set qos policy shaper SHAPER default bandwidth 80mbit
set qos policy shaper SHAPER class 10 match ip destination address 192.168.2.0/24
set qos policy shaper SHAPER class 10 bandwidth 20mbit
set interfaces ethernet eth0 qos policy shaper SHAPER
使用CAKE或HTB優先級VoIP/遊戲流量。
NetFlow/sFlow、SNMP、Syslog
set system flow-accounting interface eth0
set system flow-accounting netflow server 192.168.10.10 port 2055
set service snmp community public authorization ro
set service snmp listen-address 0.0.0.0
set system syslog host 192.168.10.20 facility all level info
set system syslog host 192.168.10.20 transport tls
Prometheus監控整合
VyOS支援通過SNMP或exporter容器匯出指標。
實踐實驗室:雙WAN負載平衡 + QoS
- 使用負載平衡規則配置兩個WAN介面(eth1、eth2)。
- 設定介面健康檢查ping。
- 為eth0配置QoS shaper,優先級必要的流量。
- 通過斷開一個WAN測試故障轉移。
- 檢查NetFlow、SNMP、syslog發送到監控伺服器。
# 檢查負載平衡狀態
show load-balancing wan
# 檢查QoS
show qos
# 檢查flow-accounting
show system flow-accounting
總結
本課程幫助您配置WAN負載平衡、QoS、流量監控,進行雙WAN實驗室練習、配置NetFlow、SNMP、syslog、Prometheus,以便在生產環境中專業地運營網路系統。