Skip to main content
Fortinet NSE4 intermediate Free with email

FortiGate Packet Flow: How a Packet Moves Through the Firewall (Free PDF)

Reviewed 2026-11-15

Direct answer
A FortiGate processes every packet in a fixed order: interface and TCP/IP stack, DoS policy, header check, IPsec decryption, admission control, then the kernel (destination NAT, routing, policy lookup, session), UTM inspection, source NAT, IPsec encryption, shaping and exit.

What Is FortiGate Packet Flow?

FortiGate packet flow is the fixed order of checks FortiOS runs on every packet. It starts at the interface and the TCP/IP stack, then runs DoS policy, header checks, IPsec decryption and admission control. The kernel comes next: destination NAT, routing, policy lookup and session handling. After that come security inspection, source NAT, IPsec encryption, traffic shaping and exit. Fortinet calls this the “life of a packet” in its Parallel Path Processing guide.

Here’s the FortiOS 7.6 order (Fortinet docs):

  1. Interface and TCP/IP stack. Every accepted packet enters through a network interface and the TCP/IP stack.
  2. DoS policy. If you’ve configured one, it runs early. Suspected attacks are blocked and other packets continue.
  3. IP integrity header checking. The header length of a TCP, UDP, ICMP, SCTP or GRE packet must be valid, or the packet is dropped.
  4. IPsec decryption. Packets that match a configured tunnel are decrypted here.
  5. Admission control. The quarantine check, plus captive portal authentication when a policy asks for it.
  6. Kernel decisions. Destination NAT, routing (including SD-WAN), stateful inspection, policy lookup and session management.
  7. UTM/NGFW inspection. Security profiles run when the matching policy has them.
  8. Kernel egress. The kernel routes the packet to the exit interface and checks the NAT table for source NAT.
  9. IPsec encryption, traffic shaping and exit. Tunnel traffic is encrypted, shaping applies if configured, and the TCP/IP stack sends the packet out.

Policy lookup isn’t step one. It sits inside step 6, after the DoS, header, IPsec and admission checks, and after destination NAT and routing. That one fact explains a lot of “why did it get dropped there?” moments.

FortiGate packet flow: DoS, header and IPsec checks, then the kernel policy lookup, then UTM, SNAT and shaping
In FortiGate packet flow, the policy lookup happens inside the kernel, after the DoS, header, IPsec and admission checks.

What Happens on Ingress Before the Policy Check?

Four checks run before the kernel decides anything.

DoS policy. DoS policies look for anomalous traffic arriving on an interface. Fortinet says they’re checked before security policies, so an attack doesn’t trigger heavier inspection (DoS policy). The anomalies are predefined Layer 3 and Layer 4 sensors: floods, scans and concurrent-session counts. You can’t add new ones. Each sensor can be set to Disable, Block or Monitor in the GUI, and to pass or block in the CLI. Flood sensors track traffic toward one destination IP. Scan sensors track one source IP.

Fortinet’s recommended starting thresholds include 2000 packets per second for tcp_syn_flood, 1000 for tcp_port_scan and 250 for icmp_flood. Create a policy at Policy & Objects > IPv4 DoS Policy. If the menu is missing, enable DoS Policy under Feature Visibility.

config firewall DoS-policy
    edit 1
        set name "wan-dos"
        set interface "wan1"
        set srcaddr "all"
        set dstaddr "all"
        set service "ALL"
        config anomaly
            edit "tcp_syn_flood"
                set status enable
                set action block
                set threshold 2000
            next
        end
    next
end

The fields come from Fortinet’s DoS policy page: name, interface, addresses and service, then one config anomaly entry per sensor. Start with Monitor and a log entry if you’re unsure of your normal traffic rate. On NP7 and NP6XLite hardware, tcp_syn_flood protection can run in hardware with SYN cookies, but DoS offloading has to be switched on first.

IP integrity header checking. The FortiGate checks the protocol header length. A packet with a bad header is dropped here and never reaches a policy.

IPsec decryption. A packet that arrives inside a tunnel is decrypted before the kernel sees it. Fortinet says this step is offloaded to and accelerated by CP9 or CP10 processors where the hardware has them. If the tunnel itself won’t come up, our IPsec VPN troubleshooting guide walks through Phase 1, Phase 2, NAT-T and MTU checks.

Admission control. The FortiGate checks that the packet isn’t from, or headed to, an address on the quarantine list. It can also impose captive portal authentication. Older Fortinet guides list FortiTelemetry here too. The version table further down shows what changed.

What Does the FortiGate Kernel Decide?

The kernel makes the forwarding decision. In order, it does these things:

  1. Destination NAT. The NAT table is checked to see whether the destination IP must change. Fortinet’s guide places this before routing. Destination NAT on a FortiGate means a virtual IP (VIP) object. If you want the basics first, our what is NAT guide covers static, dynamic and PAT.
  2. Routing, including SD-WAN. The routing table picks the egress interface and tells local traffic from forwarded traffic. SD-WAN can pick the route using internet service and application control. Our FortiGate SD-WAN PDF shows how zones, health checks and rules feed this step.
  3. Stateful inspection, policy lookup and session management. The first packet of a session is matched against the policy table and a session entry is created. Later packets are handled by a session table lookup. A stateful firewall keeps that table so replies match without a second policy check, as our types of firewalls guide explains.
  4. Session helpers. Protocols such as SIP, FTP and H.323 carry addresses or ports inside the payload. Helpers read them so the related traffic can pass.
  5. User authentication, device identification, Agentless VPN and local management traffic. These apply as the matching policy needs them. Traffic addressed to the FortiGate itself, such as an admin login, ends here. Older guides call the VPN item SSL VPN.
FortiGate packet flow in the kernel: a new session gets a policy lookup, the same session uses the session table, local traffic ends there
Only a new session gets a full policy lookup. Later packets in the same session match the session table.

How does FortiGate match firewall policies?

Top to bottom, and the first match wins. The By Sequence view shows policies in the order they’re checked (Firewall policy). Fortinet’s best-practices guide says that once traffic matches a policy, the later ones aren’t processed, so put the most specific policies at the top (Policies). If no IPv4 policy matches, the traffic hits the implicit deny and is dropped.

One exception catches people. Policies that include a VIP, or that have match-vip enabled, take priority over other policies. A deny policy meant to block VIP traffic needs match-vip on. From FortiOS 7.2.4, new deny policies have it enabled by default.

Replies are simpler. A reply packet matches the session that its first packet created, so it skips the policy lookup. You’ll see this in debug flow as a line that says it found an existing session in the reply direction.

Go deeper

This page shows the path a packet follows.

Build it yourself in the FortiGate NSE4 Lab Workbook on EVE-NG.

See the FortiGate NSE4 Lab Workbook →

How Does FortiGate Inspect Traffic in Flow Mode and Proxy Mode?

Step 7 is where security profiles run. Each firewall policy picks an inspection mode, and flow-based inspection is the default on new policies (Inspection modes). Fortinet calls flow mode the recommended choice unless you need proxy-specific features.

Flow modeProxy mode
BufferingNone. The FortiGate inspects packet by packet and holds only the last packet until the scan returns a verdictBuffers the traffic and holds the payload until the whole thing is inspected
When it finds a violationSends a reset to the receiver, which ends the connectionDrops the traffic and replaces it with a replacement message
How the modules runAll applicable flow-based modules run at once in a single passRebuilds the content, then applies features such as antivirus, web filtering, DLP, email filtering and ICAP
Needs this modeNothing. It’s the defaultSSL offloading, explicit web proxy and ZTNA. Video Filter, inline CASB, WAF and CDR are proxy-mode capabilities

Sources: flow mode, proxy mode and the 6.4 packet-flow page for the proxy feature list. Fortinet’s own advice is to check the capabilities you need before you choose a mode. Hardware helps in both: the 7.6 guide says flow-mode pattern matching is accelerated by CP8 or CP9 processors, and that some UTM/NGFW processes can be offloaded to CP9 or CP10.

FortiGate inspection mode: flow-based holds the last packet, proxy-based buffers the whole payload
Flow-based inspection scans packet by packet and holds only the last packet. Proxy-based inspection holds the payload until it is fully scanned.

To switch one policy to proxy mode in the CLI:

config firewall policy
    edit 1
        set inspection-mode proxy
    next
end

Proxy mode has a feature called client comforting. It sends small portions of the payload to the user during a long scan, so the download doesn’t time out.

Both modes run inline, in the path of the traffic. If you want the theory behind inline prevention, read our IDS vs IPS guide. The Security Profiles topic in the FortiGate NSE4 Lab Workbook is where you turn these profiles on and test them in a lab.

The 7.6 guide also splits this stage into NGFW Profile mode and NGFW Policy mode, with its own packet-flow page for each.

What Happens on Egress?

After inspection, the packet still has three jobs to finish.

  1. Routing and source NAT. The kernel routes the packet to the exit interface and checks the NAT table for source NAT. You can set source NAT in the policy (NAT on, with the outgoing interface address or an IP pool) or in a central SNAT map. With central NAT on, the NAT option inside the policy is skipped and source NAT comes from the central-snat-map rules, matched top to bottom (Central SNAT). The Firewall Policy and NAT topics in the FortiGate NSE4 Lab Workbook cover central NAT and VIP/DNAT on a topology.
  2. IPsec encryption. A packet entering a tunnel is encrypted and encapsulated just before it leaves.
  3. Traffic shaping and exit. Shaping applies if you’ve configured it. Then the TCP/IP stack sends the packet out of the egress interface.

Older guides also list WAN Optimization on this path. The 7.6 version of the page lists traffic shaping only.

What Do NP7 and CP9 Processors Do in Packet Flow?

A FortiGate can send part of this path to dedicated chips, called SPUs (security processing units). Two kinds matter here.

Network processors (NP) offload sessions. Fortinet describes NP7 as fastpath acceleration that offloads communication sessions from the CPU (NP7 acceleration). It works in three steps:

  1. The first packet of a new session goes to the CPU, which matches it against the policy.
  2. If the policy accepts the session and it can be offloaded, its session key is copied to the NP7 that received the packet.
  3. The remaining packets are fast-pathed by the NP7 and don’t touch the CPU.

An NP7 can also take on some CPU-heavy work, such as IPsec encryption and decryption. Once it hits its session limit, extra sessions go to the CPU. On FortiGates with a hyperscale licence, session and NAT setup can happen on the NP7 itself. The 7.6 guide notes that much of the traffic that needs no UTM/NGFW processing can be offloaded to NP7 processors.

NP6 is the older generation. Its guide says the first packet of a session decides whether the session can be offloaded, and that most sessions can be offloaded as long as there’s no proxy-based UTM/NGFW (NP6 sessions). Check which processor your model has before you read a diagram, because the offload rules differ.

Content processors (CP) speed up specific steps. They accelerate IPsec decryption and encryption (CP9 or CP10) and the pattern matching used by flow-based inspection (CP8 or CP9). Think of the NP as taking whole sessions off the CPU, and the CP as shortening the heavy steps inside a session.

FortiGate NP7 offload: the first packet goes to the CPU for a policy match, later packets take the NP7 fast path
The first packet of a session goes to the CPU and its session key is copied to the NP7. Later packets can skip the CPU.

This matters for troubleshooting. Debug flow can’t trace a session that an NP has offloaded, as the next section explains.

How Do You Trace a Packet With FortiGate Debug Flow?

Debug flow prints what the FortiGate does to a packet, one decision at a time. Fortinet recommends it when traffic isn’t entering or leaving the way you expect. Each command sets part of the trace, and the last command starts it (Debugging the packet flow).

diagnose debug enable
diagnose debug flow filter addr 203.0.113.10
diagnose debug flow show function-name enable
diagnose debug flow trace start 100
diagnose debug flow trace stop
diagnose debug flow filter clear

Swap in your own address. The start 100 limits the trace to 100 packets. Stop it as soon as you have what you need.

The filter takes these variables:

VariableMatches
addrAn IPv4 or IPv6 address
saddr, daddrThe source or destination address
portA port
sport, dportThe source or destination port
protoA protocol number
vdA virtual domain index (-1 matches all)
negateInverts the IPv4 or IPv6 filter
clearClears the filter

Fortinet’s sample trace of an HTTP session shows lines like these. Read each one against the stages above:

Line in the traceWhat it tells you
vd-root received a packet(proto=6, ...) from port5.The packet arrived on that interface (step 1)
allocate a new session-00000e90A new session was created for the first packet
find a route: gw-192.168.11.254 via port6The routing lookup chose a next hop and an exit interface
find SNAT: IP-192.168.11.59, port-31925Source NAT picked an address and a port
Allowed by Policy-3: SNATPolicy 3 matched and allowed the session
Find an existing session, id-00000e90, reply directionThe reply matched the session, so no new policy lookup

The exact wording and line order change between releases. Match the meaning, not the text.

Three cautions:

  • Don’t leave it running. If the FortiGate sends logs to FortiAnalyzer or FortiCloud, the debug output is recorded as event logs there. Fortinet says not to run the command longer than necessary because it generates a significant amount of data.
  • Offloaded traffic doesn’t show. Fortinet says flow monitoring doesn’t work for traffic offloaded to NP6 or NP7 processors. Test with ICMP, which isn’t offloaded, or turn offloading off. On NP6 hardware Fortinet gives diagnose npu {np6 | np6xlite | np6lite} fastpath disable as a temporary option. On NP7 hardware you turn offloading off in the firewall policy that accepts the traffic (set auto-asic-offload disable), then turn it back on afterwards.
  • Set a filter first. Our FortiGate CLI Commands PDF makes the point: an unfiltered flow debug on a busy firewall floods the console and makes the output useless.

Prefer the GUI? Fortinet also has a Debug Flow tool under Network > Diagnostics, with basic and advanced filters (Using the debug flow tool). For packets on the wire rather than decisions, see the packet sniffer commands in the same CLI PDF.

Coming from Cisco? The ASA has its own simulation command, packet-tracer, covered in our Cisco ASA commands PDF. To practise on a FortiGate without hardware, follow our guide to adding a FortiGate VM to EVE-NG.

Has FortiGate Packet Flow Changed Between FortiOS Versions?

Yes, in the names of some steps and in which chips get mentioned. Many diagrams online still use the older layout. Here’s what differs between Fortinet’s 6.4 and 7.6 guides:

StageFortiOS 6.4 guideFortiOS 7.6 guide
Admission controlQuarantine and FortiTelemetry. FortiTelemetry requires a device to have FortiClient installed before its packets are allowedQuarantine (source or destination) and captive portal. FortiTelemetry isn’t described in the body
Kernel VPN itemSSL VPNAgentless VPN
IPsec accelerationCP8 or CP9CP9 or CP10
EgressTraffic shaping and WAN OptimizationTraffic shaping

Sources: the 6.4 ingress and egress page and the 7.6 Parallel Path Processing page. Check the guide for the exact release you run before you trust a diagram from another version.

What Does the Free FortiGate Packet Flow PDF Cover?

The PDF is a short reference for the path. It opens with a one-page flow diagram, then walks the same eight stages in plain words: ingress, admission control, kernel processing, UTM/NGFW, kernel egress, egress encryption, traffic optimization and shaping, and the outbound interface. It adds a short note on the CP content processors and on what a network processor is, and it defines the terms it uses, such as DoS threshold, quarantine list, botnet, proxy-based inspection and kernel.

Some step names in it, such as FortiTelemetry, SSL VPN and WAN Optimization, come from older FortiOS guides. The version table above shows what changed in 7.6.

It stops at the order of the steps. There are no commands, no lab and no version tags. This page fills the gap with debug flow, inspection modes, NP7 offload and the 7.6 differences. The FortiGate NSE4 Lab Workbook goes further and builds the whole thing as labs on EVE-NG: firewall policy, user identification, NAT, security profiles, site-to-site and remote access VPN, HA, SD-WAN, VDOM and logging.

FortiGate packet flow free PDF covers the path and eight stages; the NSE4 workbook builds policy and profile labs
The free PDF maps the FortiGate packet flow in eight stages. The FortiGate NSE4 Lab Workbook builds firewall policy and security profile labs on EVE-NG.

Where Should You Go Next?

Frequently asked questions

What is the order of operations on a FortiGate?
A FortiGate handles a packet in this order: interface and TCP/IP stack, DoS policy, IP header check, IPsec decryption, admission control, then the kernel (destination NAT, routing, policy lookup, session handling). After that come UTM inspection, source NAT, IPsec encryption, traffic shaping and exit. This is the FortiOS 7.6 order in Fortinet's Parallel Path Processing guide.
Does FortiGate do destination NAT before routing?
Yes. In Fortinet's packet flow guide, destination NAT is the first kernel step and the routing lookup comes right after it. Source NAT happens later, on the egress path. On a FortiGate, destination NAT means a virtual IP (VIP) object, so the address change happens before the routing table picks the exit interface.
How does FortiGate handle return traffic?
A reply packet matches the session that the first packet created, so the FortiGate uses the session table instead of a new policy lookup. In debug flow you see a line saying it found an existing session in the reply direction. Fortinet's guide says later packets of a session are handled by session table lookup.
In what order does FortiGate check firewall policies?
Top to bottom, and the first match wins. The By Sequence view shows the order. If no IPv4 policy matches, the implicit deny drops the traffic. One exception: policies that include a VIP, or have match-vip enabled, take priority over other policies, so a deny rule for VIP traffic needs match-vip on.
What is the difference between flow-based and proxy-based inspection on FortiGate?
Flow-based inspection doesn't buffer. It scans packet by packet and holds only the last packet until the scan returns a verdict. Proxy-based inspection buffers the payload until it's fully inspected. Flow mode is the default on new policies. ZTNA, the explicit web proxy and SSL offloading need proxy mode, which you set per policy.
Why does debug flow show nothing for my traffic?
The session may be offloaded. Fortinet says flow monitoring doesn't work for traffic offloaded to NP6 or NP7 processors. Test with ICMP, which isn't offloaded, or turn offloading off in the policy that accepts the traffic. Also check that your filter, such as `diagnose debug flow filter addr`, matches the traffic you're sending.
What do NP7 and CP9 processors do on a FortiGate?
An NP7 offloads sessions: the first packet goes to the CPU for the policy match, the session key is copied to the NP7, and later packets are fast-pathed without the CPU. CP9 and CP10 content processors speed up specific steps, such as IPsec decryption and encryption and, with CP8, the pattern matching used by flow-based inspection.
What does a FortiGate DoS policy do, and where does it sit?
A DoS policy checks traffic arriving on an interface for Layer 3 and Layer 4 anomalies such as floods, scans and session counts. It runs before security policies, so attacks don't trigger heavier inspection. Each predefined anomaly is set to Disable, Block or Monitor, and you can't add new anomalies.
Has FortiGate packet flow changed between FortiOS versions?
The step names have. Fortinet's 6.4 guide lists quarantine and FortiTelemetry in admission control and SSL VPN in the kernel step. The 7.6 guide describes quarantine and captive portal, lists Agentless VPN, and names CP9 or CP10 for IPsec where 6.4 names CP8 or CP9. Check the guide for your release.
Where does SD-WAN fit in FortiGate packet flow?
SD-WAN is part of the routing step in the kernel. After destination NAT, the routing lookup picks the exit interface, and SD-WAN can choose the route using internet service and application control. The policy lookup comes after that. Our free FortiGate SD-WAN PDF covers zones, health checks and rules.

Questions about this PDF

No questions yet. Ask the first one.

Ask a question

Your email address won't be published. We review every question before it appears. How we handle your data. Required fields are marked

Reviewed by

CCDE/CCIE

How to cite this resource

SMEnode Labs (2026). FortiGate Packet Flow: How a Packet Moves Through the Firewall (Free PDF). SMEnode Labs. https://smenode-labs.com/free-pdf/cybersecurity/fortigate-packet-flow/

APA

SMEnode Labs. (2026). FortiGate Packet Flow: How a Packet Moves Through the Firewall (Free PDF). SMEnode Labs. https://smenode-labs.com/free-pdf/cybersecurity/fortigate-packet-flow/

BibTeX

@misc{smenodelabs2026,
  title = {FortiGate Packet Flow: How a Packet Moves Through the Firewall (Free PDF)},
  author = {{SMEnode Labs}},
  year = {2026},
  url = {https://smenode-labs.com/free-pdf/cybersecurity/fortigate-packet-flow/},
  note = {SMEnode Labs}
}