Compared
Stateful vs stateless firewall
A stateless filter judges every packet alone, by its addresses, protocol and ports. A stateful firewall remembers each connection, so it can let replies in while refusing new connections from outside.
Side by side
| Stateless | Stateful | |
|---|---|---|
| Judges | Each packet alone | Each packet as part of a connection: new, established or related |
| Replies | Need a rule of their own | Allowed, because the firewall saw the connection start |
| Remembers | Nothing | A table of connections (conntrack on Linux) |
| Classic policy | Permit and deny lines by address, protocol and port, with an implicit deny at the end | Accept established and related, allow new from inside, drop new from outside |
| Examples | A router's access control list; a cloud network ACL | iptables with conntrack; a cloud security group |
Each one explained
- Stateful firewall
- A firewall that remembers connections, so it can allow replies while refusing new connections in.
- Access control list
- An ordered list of permit and deny lines a router checks each packet against, applied to a card in or out.
- Firewall
- Rules deciding, packet by packet, what may reach or cross a device.
- Security groups and network ACLs
- The cloud's two firewalls: stateful allow rules on each instance, and stateless numbered rules on each subnet.
See the difference on real machines
Each lab is a small network of real Linux machines in your browser.
- Stateful inspection: a firewall that remembers who started it
- Router ACLs: a list on every door
- Firewall rules: keep the street out and let the staff in
- Security groups and network ACLs: the cloud's two firewalls
Open Stateful inspection: a firewall that remembers who started it