FortiGate 排錯先確認 VDOM,再看 ingress、route、policy、NAT、session 與回程。相同命令在 global、root 或其他 VDOM 看到的結果不同,不能只貼一段輸出就判斷。
系統與資源
查看 FortiOS 與系統FortiGate CLI
get system status記錄 version、build、mode、hostname、HA 與 system time。
查看效能摘要FortiGate CLI
get system performance status看 CPU、memory、session、uptime、IPS 與 average network usage。
查看即時 processesFortiGate CLI
diagnose sys top 1 20每秒更新前 20 個 process,按 q 離開。
查看 Session 統計FortiGate CLI
diagnose sys session stat注意 session、setup rate、clash、memory tension 與 dirty。
查看 Conserve Mode 門檻FortiGate CLI
diagnose hardware sysinfo conserve門檻依型號、build 與設定,不硬套固定百分比。
查看 crash logFortiGate CLI
diagnose debug crashlog read先保存輸出,再對照 reboot reason 與 firmware known issue。
介面、ARP 與路由
查看實體介面狀態FortiGate CLI
get system interface physical看 link、speed、duplex 與 error。
查看單一 NICFortiGate CLI
diagnose hardware deviceinfo nic port1介面名稱依機型;看 RX/TX errors、drops、speed。
查看 routing tableFortiGate CLI
get router info routing-table all確認 connected、static、dynamic、distance、metric 與 gateway。
查特定目的路由FortiGate CLI
get router info routing-table details 203.0.113.10部分版本語法不同,先用 ?;也可依 prefix 篩選。
查看 kernel routeFortiGate CLI
get router info kernel和 routing daemon table 比較,找未下到 kernel 的路由。
查看 ARPFortiGate CLI
get system arpVDOM 與 interface 會影響可見鄰居。
查看鄰居 cacheFortiGate CLI
diagnose ip arp listIncomplete/failed 要查 L2、VLAN、mask 與對端。
指定來源 pingFortiGate CLI
execute ping-options source 192.168.50.1
execute ping 192.0.2.1測完用 execute ping-options reset,避免後續沿用。
重設 ping optionsFortiGate CLI
execute ping-options reset完成來源/介面測試後恢復預設。
追蹤路由FortiGate CLI
execute traceroute 203.0.113.10可再用 traceroute-options 指定 source/device,完成後 reset。
Session、Sniffer 與 HA
清除 Session filterFortiGate CLI
diagnose sys session filter clear每次新查詢前先清,避免沿用舊條件。
設定 Session 來源與目的FortiGate CLI
diagnose sys session filter src 192.168.50.10
diagnose sys session filter dst 198.51.100.20可再加 sport、dport、proto 縮小。
列出符合 SessionFortiGate CLI
diagnose sys session list看 policy_id、state、NAT、npu、packets 與 timeout。
短時間抓單一主機與 443FortiGate CLI
diagnose sniffer packet any 'host 192.168.50.10 and port 443' 4 30 lverbosity 4、30 packets、absolute time;正式環境維持窄 filter。
抓 DHCP 封包FortiGate CLI
diagnose sniffer packet any 'udp and (port 67 or port 68)' 4 50 l確認 discover、offer、request、ack 經過哪些介面。
查看 HA 狀態FortiGate CLI
get system ha status確認 role、priority、uptime、sync 與 monitored interface。
查看更詳細 HAFortiGate CLI
diagnose sys ha status兩台都要查,並對照 checksum/session pickup。
怎麼確認有做對
- 從正確 VDOM 重現相同五元組,route、policy、session 與 sniffer 路徑一致。
- Sniffer 同時看到 ingress 與 egress,回程封包也回到同一設備。
- HA 兩台顯示合理角色與同步,診斷 options/filters 已 reset。
常見錯誤
- 忘記目前在哪個 VDOM。
- ping-options 設完沒有 reset。
- sniffer 用 any 且沒 filter/count。
- 只看 route,不查 policy、NAT、session 與回程。
常見問題
FortiGate ping 通,使用者還是不能上網?
Firewall 自己發出的 ping 不會完整經過同一條 forward policy、NAT、UTM 與 user authentication。要抓用戶端的 session、debug flow、sniffer 與回程。
diagnose sys session list 沒結果怎麼辦?
先 clear filter,確認 VDOM、實際 source/destination/port、封包是否抵達,再看是否走 local-in、其他 VDOM 或 session 很快結束。
延伸閱讀
版本與官方文件
參數會隨工具版本與作業系統實作改變。正式環境先用 --help、-h 或系統內建說明確認,再以當版官方文件為準。
常見問題
FortiGate ping 通,使用者還是不能上網?
Firewall 自己發出的 ping 不會完整經過同一條 forward policy、NAT、UTM 與 user authentication。要抓用戶端的 session、debug flow、sniffer 與回程。
diagnose sys session list 沒結果怎麼辦?
先 clear filter,確認 VDOM、實際 source/destination/port、封包是否抵達,再看是否走 local-in、其他 VDOM 或 session 很快結束。