FortiGate 是企業網路中最常見的防火牆之一, 提供強大的安全策略、流量控管與診斷功能。 本篇整理 CLI(Command Line Interface) 的完整指令集, 從帳號與介面管理到封包分析,協助工程師快速掌握系統運作與除錯技巧。
👤 一、帳號與系統管理
用於檢視系統狀態、版本、帳號與權限設定:
get system status get system performance status config system admin show end
建立新管理帳號:
config system admin edit admin2 set password MyStrongPassword set accprofile super_admin set vdom root next end
✅ 建議:
- 使用
set accprofile 指定權限層級(如 read_only、super_admin)。
- 開啟 two-factor 可提升安全性。
🌐 二、網路介面與 VLAN 設定
查看網路介面與狀態:
show system interface get system interface physical diagnose hardware deviceinfo nic port1 get system arp
設定靜態 IP 或 VLAN:
config system interface edit port1 set ip 192.168.1.1/24 set allowaccess ping https ssh http set alias LAN next edit vlan10 set vdom root set interface port1 set vlanid 10 set ip 10.10.10.1/24 next end
✅ 檢查:
使用 execute ping 8.8.8.8 測試外部連線是否可達。
🧱 三、防火牆 Policy 管理
列出現有的 Policy 與詳細內容:
show firewall policy show firewall policy 10
建立新防火牆 Policy:
config firewall policy edit 10 set name Allow-Web set srcintf "port1" set dstintf "port2" set srcaddr "all" set dstaddr "all" set service "HTTP" "HTTPS" set action accept set schedule "always" set nat enable next end
✅ 建議:
- Policy 順序影響流量匹配,確保允許規則在阻擋規則之前。
- 可用
diagnose sys session list | grep x.x.x.x查看是否被匹配。
🛰️ 四、路由檢查與流量追蹤
查看靜態與動態路由表:
get router info routing-table all show router static get router info routing-table details 10.1.1.0
追蹤封包路徑:
execute traceroute 8.8.8.8 execute ping 192.168.1.10
✅ 小技巧: 若找不到路由,可檢查 Default Route 或 Policy 是否放行。
📡 五、封包分析與 Debug Flow
最常用的診斷與封包追蹤指令:
diagnose sniffer packet any '(src host 10.1.1.10 or dst host 192.168.10.20)' 4 0 diag debug enable diag debug flow show console enable diag debug flow filter addr 192.168.1.100 diag debug flow trace start 100
停止 debug:
diag debug disable
✅ 建議:
sniffer packet適合快速觀察實體介面流量。debug flow可精準追蹤 Policy 與 NAT 流向。- 可於 GUI → Packet Capture 匯出
.pcap檔分析。
🧰 六、系統診斷與效能監控
即時監控系統效能與連線狀況:
get system performance status diag sys top diag sys session stat
清除過多 session:
diag sys session clear
✅ 提示:
若 CPU 或記憶體使用率異常,可用 diag sys top 觀察問題進程。
📘 結語
熟悉 FortiGate CLI 指令,能讓網管與資安工程師更快定位問題、驗證設定並進行效能調整。 無論是帳號管理、Policy 建置或封包分析,CLI 皆提供比 GUI 更細緻的診斷能力。 建議日常維運中,定期導出設定備份與監控指令輸出,確保網路穩定與安全。
— WWFandy・網路與資安筆記
沒有留言: