Fortinet Tìm hiểu về cách xử lý gói tin của của NGFW Firewall Fortigate

kevink

Intern
FortiGate xử lý gói tin theo mô hình “parallel path processing / life of a packet”: khi gói nhập vào, FortiGate thực hiện các bước kiểm tra khởi đầu (L2/L3), lookup session/policy, quyết định đường đi (fastpath hay đi qua CPU/engine), rồi áp dụng các profile bảo mật (IPS, AV, Web-filter, DLP, APP-control) theo inspection mode (flow-based hoặc proxy-based). Các thao tác nặng (VPN crypto, DPI pattern match, file scan, SSL handling) có thể được offload sang NP/CP (ASIC/SPU) trên nhiều model để tăng hiệu năng.



1) Life of a packet — chuỗi bước (conceptual, từ ingress → egress)​

Các bước chính khi một gói vào FortiGate là:

  1. Ingress (Layer 1/2 receive) — gói tới interface, card nhận gói.

  2. Initial processing & classifier — kiểm tra header L2/L3, tạm thời lưu/buffer nếu cần.

  3. Session lookup / new session decision — FortiGate kiểm tra bảng session (session table). Nếu là gói khởi tạo session mới: gói được đưa lên CPU để thực hiện policy lookup, routing và áp dụng security profiles cho lần đầu (ctl plane xử lý). Nếu session đã tồn tại và được “accelerated”, gói có thể dùng fast path/NP offload.

  4. Security policy matching — match với firewall policy (VDOM-aware). Policy xác định inspection profile (flow/proxy) và security profiles cần áp dụng.

  5. Inspection engine(s) — tùy policy và mode: gói/luồng sẽ được đi qua IPS engine (flow-based) hoặc được buffer/reconstructed bởi proxy engine để làm deep content inspection (proxy-based) — thứ tự các profile khi ở proxy mode: VoIP → DLP → Email → WebFilter → AV → ICAP (theo docs).

  6. Offload / Fastpath decision — khi session chấp nhận và không cần check thêm, FortiGate có thể offload session vào NP/CP để xử lý các gói tiếp theo (bypass CPU), hoặc giữ trên CPU/engine nếu cần tiếp tục DPI/proxy.

  7. Egress (transmit) — sau khi pass/modified/blocked, gói được transmit ra interface đích.


2) Fast path / Offload (NP, CP, SPU)​

  • Fortinet sử dụng Network Processors (NP) và Content Processors (CP) (hoặc gọi chung là SPU/FortiASIC) để offload các tác vụ cụ thể: session forwarding (fastpath), IPsec/SSL crypto, DPI pattern matching, AV scan acceleration. Khi session được “accelerated” thì packet-by-packet không cần CPU nữa mà đi qua NP fastpath — điều này tăng throughput và giảm latency.

  • Quy tắc: gói đầu tiên của session luôn đi qua CPU để policy decision; nếu hợp lệ và phù hợp điều kiện offload thì session sẽ bị offload cho NP/CP. Một số thao tác (ví dụ: SSL full inspection, proxy buffering file scan) buộc session phải ở CPU/proxy path nên không offload được

  • Tài liệu hardware acceleration guide giải thích chi tiết những gì NP7/CP9 có thể offload (VPN, IPS pre-scan, DFA DPI, AES crypto).

3) Flow-based vs Proxy-based inspection — điểm khác biệt và tác động lên packet path​

  • Flow-based inspection
    • Là mô hình “inline, stateful and streaming”: gói được xử lý bởi IPS engine theo luồng (flow), không reconstruct và không cache toàn bộ nội dung. Tài nguyên nhẹ hơn, latency thấp hơn, phù hợp cho throughput cao. Flow-based có thể áp dụng IPS, App Control, Web Filter, DLP (không khuyến nghị DLP heavy) và AntiVirus (flow AV giới hạn).
  • Proxy-based inspection
    • FortiGate reconstructs / buffers nội dung session (ví dụ HTTP object, email, file) và gửi nội dung đó cho các module (AV, Webfilter, DLP, ICAP) để quét. Nếu không có threat, proxy sẽ relay nội dung; nếu có, proxy có thể chặn/replace. Proxy-mode cung cấp khả năng phát hiện sâu hơn nhưng tốn CPU/memory và gây latency/throughput giảm. Proxy mode cũng thay đổi luồng xử lý gói (packet được buffer, một số kiểm tra sẽ chạy ở proxy engine thay vì đơn thuần flow IPS).
Tác động thực tế: chọn proxy hay flow ảnh hưởng trực tiếp đến khả năng offload sang NP/CP: nhiều kiểm tra proxy buộc session phải giữ trên CPU và không offload được, dẫn tới throughput thấp hơn.



4) SSL/TLS inspection & ảnh hưởng tới luồng gói​

  • FortiGate hỗ trợ SSL inspection ở hai chế độ (certificate inspection/break-and-inspect). Khi cần decrypt để DPI (full SSL inspection), FortiGate phải terminate TLS, giải mã, kiểm tra nội dung (IPS/AV/Webfilter), rồi tái-encrypt cho phía đích — thao tác này buộc session ở CPU/proxy path (và có overhead). Mô hình này có thể sử dụng CP/ASIC để tăng hiệu năng cho phần crypto nhưng vẫn có giới hạn liên quan tới policy và feature bật.


5) Thứ tự áp dụng security profiles (proxy mode) — vì sao thứ tự quan trọng​

Trong proxy-based mode, FortiGate áp dụng một số service theo thứ tự nhất định (theo docs): VoIP → DLP → Email filter (Anti-Spam) → Web filter → AntiVirus → ICAP. Thứ tự này quyết định khi nào nội dung bị buffer, khi nào bị scan, và ảnh hưởng tới việc có thể offload session hay không.



6) Hiện thực trong FortiOS: session table, VDOM, policy lookup, HA/acceleration caveats​

  • Session table & VDOM: session lưu trạng thái, thông tin về chính sách đã match, thông tin offload. VDOM tách biệt session/policy giữa các tenant/compact evn Fortinet.

  • HA & offload: trong HA (active-active/active-passive) có các lưu ý về NP offload, session synchronization và HMAC offloading — Fortinet docs mô tả cách NP offload tương tác với HA. Nếu cấu hình sai, một số session có thể không được offload khiến hiệu năng giảm.
 
Back
Top