4.3.29 · D1Computer Networks

Foundations — Firewalls — stateless vs stateful packet filtering

1,797 words8 min readBack to topic

Before you can judge that question, you must be able to read every "address label" a firewall reads. This page builds each one from nothing — no prior networking assumed. We link the parent Firewalls topic and the prerequisite vault notes as they arise.


0. What is a "packet"? (the atom of everything below)

Figure — Firewalls — stateless vs stateful packet filtering

1. IP address — which machine

Related vault note: OSI Model — Layers 3 and 4 — the IP address lives at Layer 3.


2. Port number — which door on that machine

Figure — Firewalls — stateless vs stateful packet filtering

Ports live at Layer 4 — see OSI Model — Layers 3 and 4.


3. Protocol — what kind of conversation


4. TCP flags — the little on/off switches

This is the single most important symbol in the whole parent note, so we build it slowly.

See the dedicated note TCP Flags (SYN ACK FIN RST).

The handshake picture — where SYN and ACK come from

Figure — Firewalls — stateless vs stateful packet filtering

Full details: TCP Three-Way Handshake.


5. The 5-tuple — the fingerprint of one conversation

Now stack sections 1–3 together.

Related: Network Address Translation (NAT) also keeps a per-connection table, and Access Control Lists (ACLs) are the ordered rule lists a stateless filter walks.


6. The decision notation f(...), ALLOW/DENY, and


Prerequisite map

Packet = header + payload

IP address L3

Port number L4

Protocol TCP UDP ICMP

TCP flags SYN ACK FIN RST

Three-way handshake

5-tuple fingerprint

State table = memory

Stateless ACK trick

Stateful decision rule

Firewalls stateless vs stateful

Each foundation feeds exactly the part of the parent that would otherwise be a mystery symbol.


Equipment checklist

Cover the right side and test yourself. If any line stumps you, reread its section above.

A packet is made of which two parts?
A header (the labels) and a payload (the data inside).
What does an IP address identify?
One machine on the network — its "house address".
What does 10.0.0.0/24 mean?
All addresses 10.0.0.010.0.0.255; the first 24 bits are fixed.
What does a port number identify?
One program/service on a machine — a numbered "door".
Why is the reply's destination port >1023?
It returns to the high, temporary source port the client chose.
Name the three protocols the firewall distinguishes.
TCP, UDP, ICMP.
What does "the ACK flag is set" mean literally?
The ACK bit equals 1.
Which is the only TCP packet with ACK=0?
The very first SYN of a new connection.
What are the three handshake packets in order?
SYN, SYN-ACK, ACK.
List the five fields of the 5-tuple.
srcIP, dstIP, srcPort, dstPort, protocol.
What is a state table?
The firewall's memory: one row per active 5-tuple plus its TCP phase.
Read in plain words.
"This packet's connection is already in my remembered list."
What does mean?
"If and only if" — both sides are true together or false together.