Life of a Packet
Follow a packet through the data plane to see when the device selects a route, applies security policy, and rewrites addresses, and where it drops packets.
Packet processing in the data plane can be summarized in four stages. The order matters when you write a rule or investigate a drop: after destination NAT, for example, a security rule matches the original destination address but the zone of the translated one.
- 1Ingress
- Parse headers
- Reassemble fragments
- Route lookup and zones
- Zone protection checks
- 2Session lookup
- Find the session
- Found
- Use its NAT mapping
- Not found: set up
- New-session limits
- Create the session
- NAT decision
- 3Inspection
- Protocol decoding
- Application identification
- Lua plugins
- Policy enforcement
- 4Egress
- NAT translation
- TCP adjustments, re-fragmentation
- Route and MTU check
- Transmit or deliver locally
The diagram shows the typical order on a Layer 3 interface. Virtual wire and probe interfaces skip some steps.
1. Ingress
Ingress prepares packets for session lookup: it parses the packet, reassembles fragments, finds the route and zones, and drops packets that fail zone protection.
Parsing
When an Ethernet port receives a frame, the data plane parses its headers. It recognizes Ethernet, VLAN tags, PPPoE, MPLS, IPv4 and IPv6, transport headers, and common tunnel headers. Later steps reuse the parsed fields. Parsing itself does not discard malformed packets. Input checks and zone protection can discard them later.
Reassembly
The device reassembles IP fragments before inspection so that later steps can see the complete transport header and payload.
The device discards fragments that do not arrive in time to complete reassembly, exceed reassembly limits, or need a new entry in a full reassembly table. Overlapping or duplicate fragments count as TearDrop attacks. A fragment that would make the reassembled IP packet exceed the protocol’s length limit counts as Ping of Death. See Zone Protection.
The reassembled IP packet re-enters ingress. At egress, the device splits it into fragments again.
Route lookup and zones
The device looks up the route for the packet's original destination, before any NAT, and records:
- Egress interface: the interface selected by the route lookup. If there are multiple equal-cost paths, the device selects a path per flow.
- Source zone: the zone of the interface that received the packet.
- Destination zone: the zone of the egress interface.
- Local destination: whether the packet is addressed to the device itself, and whether it is a broadcast.
For a packet addressed to the device, the destination zone is the zone of the interface that owns the address. If that interface has no zone, the destination zone is the source zone, so the packet matches intra-zone rules.
If the lookup finds no route, processing continues. The device drops the packet at egress if the final destination is still unreachable. NAT and security policy use the lookup results. Destination NAT triggers a second lookup for the translated address.
Zone protection checks
Before looking up the session, the device runs the zone protection built-in checks and any packet checks and per-protocol rate limits enabled in the zone’s profile. The profile's new-session limits run later, during session setup.
2. Session lookup
The device looks up the packet's session by its addresses, ports, IP protocol, and source and destination zones. A request and its reply find the same session. For ICMP echo, the identifier and sequence number take the place of ports. A NAT reply also finds its session by the translated addresses and ports.
One data-plane core handles both directions of a session, so a single session's throughput is limited to what one core can process.
A packet that finds its session skips setup and goes straight to inspection, using the session's NAT mapping. It still goes through application identification and security policy there. A packet that finds none sets up a new session, if it is eligible.
Packets without a session
The device doesn't create sessions for:
- Non-IP frames, such as ARP.
- IP fragments, until reassembly completes them.
- ICMP and ICMPv6 messages other than echo, timestamp, and information request and reply. This includes ICMP errors and IPv6 neighbor discovery.
- IPv4 broadcasts.
Traffic forwarded without a session skips inspection and security policy. Fragments wait for reassembly and then re-enter processing as a complete IP packet. ICMP errors associated with a translated session still undergo NAT translation.
Session setup
A packet that finds no session can start one if it is eligible and the device has room for it.
- TCP without SYN. By default, the device drops a TCP segment that lacks SYN and finds no session. You can allow this traffic to continue without inspection in Device > Setup > Data Plane.
- Zone protection. The source zone’s protection profile can limit the new-session rate. Its first-packet drop and SYN Cookie settings control how the device handles excess SYNs.
- Session creation failure. If the device cannot create a session, for example when the table is full, Fallback Action normally decides what happens. The default is to drop the packet. Bypass lets the packet continue without a session, inspection, or security policy.
An ACK carrying a valid SYN cookie can open a session. The device drops it if session creation fails.
The device usually treats the sender of the first packet as the client. For UDP, if that packet comes from a recognized server port (53 or 443 by default), the device treats it as a reply and identifies the other endpoint as the client.
NAT decision
When a session starts, an applicable ALG mapping can determine its translation. Otherwise, the device checks the NAT rules in order. It matches the original addresses, ports, protocol, and source zone, along with the destination zone and egress interface from the initial route lookup. The session keeps the resulting translation.
For traffic that requires translation, the device allocates an address and port and records both the original and translated endpoints.
- With destination NAT, the device looks up the translated destination. Security policy and forwarding use the egress interface and destination zone from this second lookup.
- If only source NAT matches traffic addressed to the device itself, the device leaves the addresses unchanged.
The decision fails, and the packet is dropped, when the pool has no free address or port, when the translated session would collide with an existing one, or when the rule's pool or static address can't be resolved. NAT translates TCP, UDP, and ICMP echo over IPv4.
The device drops unsolicited packets to NAT-owned addresses when no rule or mapping handles them. Addresses assigned to the device remain available for local delivery, subject to policy. UPnP and NAT-PMP mappings can translate traffic to a mapped host, subject to security policy.
The NAT decision doesn't rewrite the packet yet. NAT translation happens at egress, after security policy.
Session state and timeouts
Each packet resets the session’s idle timer. The device removes a session that stays idle longer than the timeout for its protocol and state: first packet only, handshake, established, closing, or denied. You set the timeouts under Device > Setup > Data Plane.
A TCP session counts as established once it carries payload; a handshake without data stays on the handshake timeout. A UDP, ICMP, or other session leaves the first-packet state on its second packet, in either direction. Once identified, an application can set a timeout of its own for the session.
When the session table fills past a high watermark, the device shortens every timeout until usage falls back below a low watermark. Both watermarks and the scaling are set on the same page.
A new SYN on a TCP session that is closing or denied replaces that session with a new one.
3. Inspection
Every packet of a session goes through these steps, in order:
- Protocol decoding names the application-layer protocol from the payload and, while no payload has been seen, from well-known ports, giving up after 20 packets with payload. Decoders for TLS, HTTP, QUIC, DNS, and FTP fill session fields such as the TLS server name, HTTP host and URL, and DNS query name. The device then adds generalized fields, such as destination FQDN from the HTTP host or TLS server name, and enriched fields looked up from the addresses, such as country and ASN.
- Application identification matches built-in signatures and your application signature rules. The application can become more specific as the session goes on, until it is fixed after 20 packets with payload.
- Lua plugins run, in priority order. See Plugins.
- Policy enforcement: the device evaluates the security policy using the available fields.
- The device counts rule hits for allowed and denied traffic. Traffic that passes inspection contributes to analytics.
For rules that match a TLS or QUIC server name, the device may need several packets to read the client’s handshake message. By default, it can hold up to 4 TLS packets or 8 QUIC packets. If the buffer fills before the server name is known, inspection continues with the available fields.
Security policy
The device evaluates the security rules from the session's first packet, with the fields known at that moment.
- Fields: addresses and ports are the original, pre-NAT values. The destination zone and interface are the post-NAT ones from the NAT decision.
- Rule choice: the first enabled, in-schedule rule whose conditions all match applies. If none
matches, the built-in
intra-zone-defaultrule applies when the source and destination zones are the same, andinter-zone-defaultotherwise. - Fields that arrive later: a condition on a field the device hasn't decoded yet, such as the application, the server name, or a URL, doesn't match. A condition that excludes values, such as "application is not X", matches only once the field is final.
- Re-evaluation: while a session is allowed, the device evaluates the policy again whenever the matching changes: a newly decoded field, a published policy change, or a schedule boundary. The session can then match another rule, including a deny rule.
- Deny is final: once a session is denied, it stays denied for its lifetime, even if later fields would match an allow rule.
A typical TCP SYN arrives before the device knows the application or server name. The device evaluates the SYN using the fields already available, such as zones, addresses, and ports. If no explicit rule matches and inter-zone-default denies the session, later application identification cannot reopen it. To allow traffic by application or domain, the policy must also permit the initial handshake.
Once the device denies a session, it keeps the session in the table until the denied-session timeout expires. It drops subsequent traffic in that session, subject to any response configured on the deny rule.
- HTTP response profile: the client receives the configured HTTP response.
- DNS response profile: the query passes and the server's answer is replaced with the configured one.
- TCP reset: both ends receive a reset.
- QUIC close: the client receives a QUIC close frame where its QUIC version supports one.
If the deny rule has no response override, the device uses the application’s default deny behavior. A denial by a built-in default rule silently drops the traffic.
Session records
At the end of a session, the device writes a record if a rule applied during the session requested logging or Record every session is enabled. The end reason identifies what closed the session.
| End reason | Meaning |
|---|---|
aged-out | The session reached its timeout |
tcp-fin | Both ends closed the TCP connection |
tcp-rst | A TCP reset closed the connection |
tcp-reuse | A new connection with the same addresses and ports replaced it |
policy-deny | The security policy denied it |
unknown | Any other reason, such as clearing sessions manually |
4. Egress
Egress applies the session's NAT mapping and sends the packet on: out of an interface, or to a service on the device itself.
NAT translation
After security policy allows a packet, the device applies the session’s NAT mapping. It rewrites the source or destination address and port for client traffic, reverses the mapping for replies, and updates the checksums. For ICMP echo, the mapping uses the echo identifier in place of a port.
- ICMP errors: an ICMP error about a translated session, such as one from a router on the path, has the packet inside it translated back, so the original host recognizes it.
- ARP: the device answers ARP requests for its NAT pool and destination NAT addresses that fall in an interface's subnet, so neighbors send that traffic to the device.
Forwarding
Last, the device prepares the packet for transmission:
- TCP adjustments: if the device changed the TCP sequence numbers, for example to answer a SYN with a SYN cookie, it adjusts the numbers on every later packet.
- Re-fragmentation: the device splits a reassembled IP packet into fragments no larger than the largest original fragment or than the egress interface's MTU allows.
- Route and MTU: the device looks up the route for the final destination, decrements the TTL or hop limit, and checks the egress MTU. An oversized IPv4 packet with Don't Fragment set triggers ICMP Fragmentation Needed, translated back for a NAT session. An oversized transit IPv6 packet triggers ICMPv6 Packet Too Big. Without a route, the packet is silently dropped.
- Transmission: the packet leaves through the egress interface.
Traffic to the device
Traffic addressed to the device goes through inspection and security policy when it has a session. Before local delivery, the receiving interface applies its management access profile.
- Accept replies to connections initiated by the device.
- Accept traffic the interface needs to operate, including ICMP errors, IPv6 neighbor discovery, and DHCP.
- For other traffic, require a profile on the receiving interface.
- Check that the profile enables the requested service.
- Check that the profile permits the source address.
The interface silently drops traffic that fails these checks. It evaluates IPv4 fragments after reassembly and rejects IPv6 fragments. The profile’s gate activity shows the counters for data interfaces.
Interface roles
| Stage | Layer 3 | Virtual wire | Probe |
|---|---|---|---|
| Ingress | Routing table for the route and destination zone | Destination is the peer port and its zone; no SYN cookies | Destination zone is the source zone; no zone protection |
| Session lookup | Yes, with NAT | Yes, without NAT | Yes, without NAT |
| Inspection | Yes | Yes | Yes; nothing is forwarded |
| Egress | NAT translation, then routing | Out the peer port, unchanged | Dropped |
A virtual wire passes frames between its two members without routing them. A probe inspects mirrored traffic and records sessions, then drops every packet. On a probe, TCP connections already open when mirroring starts never get a session, since their packets carry no SYN.
Where packets are dropped
| Stage | Reasons | Where to see it |
|---|---|---|
| Ingress | Invalid IP header, or internal queue between cores full | Packet capture drop stage, when available |
| Ingress | Reassembly timeout, table or fragment limit, overlapping or oversized fragments | Zone protection attack statistics for attacks |
| Ingress | Failed zone protection checks, flood limits | Zone protection attack statistics for reported attacks, packet capture drop stage |
| Session lookup | Zone protection new-session limits | Zone protection attack statistics for reported attacks, packet capture drop stage |
| Session lookup | TCP without SYN and without a session, when configured to drop it | Packet capture drop stage |
| Session lookup | Session creation failure, such as a full table with the fallback action set to drop | Packet capture drop stage |
| Session lookup | NAT address or port exhaustion, unresolved translation, collision, or unsolicited traffic to a NAT address without a mapping | Packet capture drop stage |
| Inspection | Dropped by a Lua plugin | The plugin's drop counter in its activity statistics |
| Inspection | Deny rule or default deny rule | Rule hit counts, policy-deny session records when logging is enabled |
| Inspection | Traffic shaping drops | Packet capture drop stage |
| Egress | No route | Packet capture drop stage |
| Egress | TTL or hop limit expired, IPv4 over MTU with Don't Fragment set, or IPv6 over MTU | Packet capture drop stage, ICMP if returned |
| Egress | Traffic to the device with no management access profile, a disallowed service or source, or IPv6 fragments | Management access gate activity |
Use the drop stage in Packet Capture to see packets the device captured as it discarded them. Some drops, such as reassembly timeouts, can occur without appearing in the capture. To check which rules a session would match without sending traffic, use Policy Verification.