Types of Network Firewalls
What a firewall is, and how stateless, stateful, and next-generation firewalls differ in what they can see and decide.
1What a firewall is
A firewall allows or denies network traffic going into or out of a network. The firewall itself is software; it can run on a dedicated, standalone device, or be built into another network device such as a router. What matters is what it checks and what rules it follows.
2Packets, ports, and protocols
Data travels across networks in small pieces called packets. Each packet has a header (addressing information) and a payload (the content).
A port number tells the receiving computer which service the packet is for, like an apartment number on a building address. A protocol is the set of rules for the conversation (TCP, UDP, ICMP). Some common ports:
| Port | Service |
|---|---|
22 | SSH (remote login) |
25 | SMTP (sending email) |
53 | DNS (name lookups) |
80 | HTTP (web, unencrypted) |
443 | HTTPS (web, encrypted) |
3389 | RDP (remote desktop) |
3Stateless firewalls
A stateless firewall filters traffic using only the information in each packet's header: IP addresses, ports, and protocols. It judges every packet on its own, with no memory of earlier packets. It is fast and simple: “allow TCP port 443 to the web server; deny everything from 198.51.100.0/24.”
Its limit: it cannot tell whether a packet is a reply to something a computer inside asked for, or an unsolicited packet pretending to be a reply. To let web pages load, a stateless firewall must leave broader openings for incoming replies, which an attacker can try to slip through.
4Stateful firewalls
A stateful firewall (also called dynamic packet filtering) tracks the state of the connections passing through it. It remembers that a computer inside started a conversation with a website, so it lets that website's replies back in, and it drops incoming packets that do not belong to any conversation started from inside. It can filter by connection-related rules in addition to everything a stateless firewall does, giving more control over what enters and leaves.
5Next-generation firewalls
A next-generation firewall (NGFW) has the capabilities of stateless and stateful firewalls plus advanced features:
- Intrusion prevention: recognizes attack patterns in traffic and blocks them.
- Deep packet inspection: looks inside the payload, not just the header, for example spotting malware in a file download.
- Filtering by application type: allows or blocks specific applications (a video-streaming app, a file-sharing app) even when they use common ports like 443.
6Comparing them
| Question the firewall can answer | Stateless | Stateful | NGFW |
|---|---|---|---|
| Is this packet from an allowed address, port, and protocol? | Yes | Yes | Yes |
| Is this packet part of a conversation started from inside? | No | Yes | Yes |
| Does the content contain malware or an attack pattern? | No | No | Yes |
| Which application is this (even on port 443)? | No | No | Yes |
Stateless sees one packet's header. Stateful also sees the conversation it belongs to. A next-generation firewall also sees the content and the application.
7Worked examples
Unsolicited “replies”
An attacker sends packets to a school network that are made to look like replies to web requests, though no one inside made those requests. Which firewall type can block them by default, and why?
- 1A stateless firewall looks at each packet's header alone; a well-forged reply looks like any other reply.
- 2A stateful firewall tracks which conversations were started from inside. These packets match no conversation, so it drops them.
Blocking one app on port 443
A company wants to block a particular file-sharing app. The app uses port 443, the same port as all secure websites. Which firewall type can do this?
- 1Blocking port 443 would block every secure website: not acceptable.
- 2Stateless and stateful firewalls see the port and connection, not which application is using it.
- 3An NGFW can filter by application type, identifying and blocking that app while allowing other port-443 traffic.
Malware inside a download
An employee downloads a spreadsheet from an allowed website over HTTPS. The file contains known malware. Which firewall type could catch it?
- 1The header shows an allowed address, port 443, and TCP, so stateless and stateful firewalls let it through.
- 2Catching it requires looking inside the content.
- 3An NGFW with deep packet inspection (and the ability to inspect the encrypted traffic) can scan the file and block known malware.
Router or separate box?
A small office's internet router has a built-in firewall. A larger company uses a dedicated firewall appliance. Are both firewalls?
- 1A firewall is software that allows or denies traffic.
- 2It can run on a standalone device or be integrated into another device like a router.
- 3What matters is the type (stateless, stateful, NGFW) and the rules, not the box it runs on.
8Common mistakes
A firewall is software. It may run on its own device or inside a router.
Stateless: each packet alone, by header. Stateful: remembers connections and filters by connection state too.
Header-based firewalls cannot see content. Deep packet inspection, a next-generation feature, looks inside.
“A stateful firewall is needed because it tracks the state of each connection, so it can drop incoming packets that do not belong to a conversation started from inside the network. A stateless firewall checks only header information like IP addresses and ports, so it cannot tell a forged reply from a real one.”
Name the type and connect its specific capability to the traffic in question.