There are five main types of firewalls, sorted by how they decide what gets through: packet filtering, stateful inspection, circuit-level gateway, proxy (application-level gateway) and next-generation firewall (NGFW). Web application firewalls, UTMs and cloud firewalls build on those. Hardware, software and cloud describe how a firewall is delivered, not how it thinks.
That’s the list. The part that actually matters, on an exam and on a real network, is what each type remembers and what it reads. A packet filter judges every packet alone. A stateful firewall keeps a ledger of conversations. An NGFW reads far enough into the traffic to tell SSH from HTTPS on the same port.
Here’s the whole thing on one screen.
| Type | Reads up to | Remembers sessions? | Typical example |
|---|---|---|---|
| Packet filtering (stateless) | Layers 3-4: IPs, protocol, ports, TCP flags | No | Cisco IOS extended ACL, AWS network ACL |
| Stateful inspection | Layers 3-4 plus connection state | Yes | AWS security group, Windows Firewall, Linux nftables with conntrack |
| Circuit-level gateway | Layer 5: session setup | Yes, per relayed session | SOCKS proxy |
| Proxy / application-level gateway | Layer 7, one protocol at a time | Yes, as two separate connections | Squid web proxy |
| Next-generation firewall (NGFW) | Layers 3-7: apps, users, threats | Yes | FortiGate, Cisco Secure Firewall (FTD), Palo Alto Networks PA-Series |
| Web application firewall (WAF) | Layer 7, HTTP/HTTPS only | Per request | AWS WAF, FortiWeb |
Further down there’s a worked example that runs the same eight packets through five of these. That’s where the differences stop being definitions and start being verdicts.

Three generations. Packet filters (late 1980s) read only the outside of the envelope: addresses, ports and flags. Stateful firewalls (1990s) add a ledger of open sessions. NGFWs, a category Gartner defined in 2009, open the envelope to identify the application, the user and known attacks.
What Is a Firewall in Networking?
A firewall is a device or piece of software that sits between two networks, or between a network and one host, and decides which traffic may cross based on rules you write. Cisco calls it “the first line of defense that monitors incoming and outgoing traffic” (Cisco: What is a firewall?).
So when someone asks “what is a firewall in a computer”, the honest answer is: the same idea, shrunk to one machine. Windows has had one built in for years. Microsoft’s current docs describe it as a host-based firewall that’s on by default and will “block all incoming traffic, unless solicited or matching a rule” (Microsoft: Windows Firewall overview).
Keep that phrase in mind. Unless solicited. That idea is the whole difference between the first two types on the list.
What Are the Main Types of Firewalls?
Sorted by filtering method, the five are:
- Packet filtering firewall. Checks each packet’s header against a rule list. No memory.
- Stateful inspection firewall. Same header checks, plus a table of open connections, so replies get in and strays don’t.
- Circuit-level gateway. Checks that a session was set up properly, then relays bytes without reading them.
- Proxy firewall (application-level gateway). Ends your connection and opens its own, so it can read and police one application protocol.
- Next-generation firewall (NGFW). A stateful firewall that also identifies applications, users and known attacks.
Then there are the specialists. A web application firewall (WAF) guards one web app. A UTM is an all-in-one box for smaller sites. A cloud firewall is any of the above, sold as a service or a VM.
Why do some lists say 3 types and others say 7?
Because they’re sorting by different things. Honestly, this one trips people up all the time.
- 3 types is the classic textbook split by filtering method: packet filtering, stateful inspection and application-level (proxy).
- 4 types adds the circuit-level gateway. Older references and forum posts often use this split.
- 5 types adds the NGFW, which is what most current lists do.
- 7 types usually mixes in WAF and cloud or UTM, even though those describe what’s protected or how it’s sold.
And “the two main types” almost always means hardware vs software, or network-based vs host-based. That’s a delivery question, not a filtering one. Every list is “right”. They’re just answering different questions.
How Does a Packet Filtering Firewall Work?
A packet filtering firewall compares each packet’s header, meaning source and destination IP, protocol, source and destination port, and TCP flags, against an ordered rule list. The first match wins. No match means the implicit deny at the bottom drops it.
The key word is each. A packet filter is stateless. It has no idea whether the packet in front of it belongs to a conversation it saw a second ago.
That creates an annoying problem. If you let your users browse out, the replies come back in, from random web servers, to whatever port the user’s machine picked. How do you write an inbound rule for that without opening everything?
What does a packet filtering firewall example look like?
Here’s how you do it on a Cisco router with an extended ACL. This is the rule set the worked example uses later, applied inbound on the internet-facing port.
ip access-list extended WAN-IN
5 permit tcp any host 10.1.30.10 eq 443
10 permit tcp any 10.1.0.0 0.0.255.255 established
20 permit udp host 198.51.100.53 eq domain 10.1.0.0 0.0.255.255 gt 1023
!
interface GigabitEthernet0/0/0
ip access-group WAN-IN in
Line 5 publishes the company web server. Line 10 is the classic trick for return traffic: the established option. Cisco’s IOS XE 17 guide says it “has the same function as matching on the ack or rst flag” (Cisco ACLs Configuration Guide, IOS XE 17). A packet with ACK or RST set can’t be the first packet of a TCP session, so the router assumes it’s a reply.
Assumes. That’s the catch.
The router doesn’t check whether that session exists. It only checks two bits. Count the combinations of the six classic TCP flags and you get 64. Of those, 48 have ACK or RST set, so 75% of all possible flag combinations sail past established, whether or not anyone inside ever opened a connection. Line 20 has the same weakness for UDP, which has no flags at all. To let DNS answers back in, it opens every port from 1024 to 65535 on every inside host to anything claiming to come from port 53 of your resolver. That’s 64,512 UDP ports per host.

The established option looks only at the flags: a match means ACK or RST is set. That’s 48 of the 64 combinations of the six classic TCP flags, whether or not the session exists. A stateful firewall also checks the address and port pair against its session table.
What are the advantages and disadvantages of packet filtering?
Advantages:
- Fast. There’s almost nothing to compute per packet.
- Cheap. Every router and Layer 3 switch already supports ACLs.
- Predictable. You can read the whole policy top to bottom.
Disadvantages:
- No memory, so return traffic needs wide, guessable holes like the two above.
- Trusts source addresses and ports, which are easy to forge.
- Blind to content. A permitted port carries whatever it carries.
Packet filters still earn their place. Between internal VLANs, on a core switch, as a coarse guard rail in front of something smarter. Just not alone at the internet edge.
Cisco did build a middle step, by the way. Reflexive ACLs create temporary entries when an inside host opens a session and remove them when it ends. Cisco calls this “a truer form of session filtering” that’s “much harder to spoof” (Cisco Catalyst 9500 IOS XE 17.14 guide: Reflexive Access Lists). That’s statefulness, bolted onto an ACL.

A stateless filter judges each packet on its own header. A stateful firewall also checks it against its table of open sessions, so a reply gets in only if the matching conversation started from inside.
What Is a Stateful Inspection Firewall?
A stateful inspection firewall checks the same headers as a packet filter, but it also records every connection it allows in a state table: protocol, source IP and port, destination IP and port, plus where a TCP session is in its handshake and when the entry times out. A reply is allowed only if it matches an entry. Anything else coming in is unsolicited, and dropped unless a rule says otherwise.
You’ll also see it called dynamic packet filtering or a stateful packet filtering firewall. Same thing. The idea dates to the 1990s, and Check Point claims credit for pioneering it with FireWall-1. Pretty much every firewall sold today is at least stateful.
The payoff is easy to see. No established hack, no 64,512-port hole. You write the rules for traffic that starts a conversation, and the box handles the replies by itself. UDP gets a pseudo-session too: the firewall remembers “10.1.10.25 asked 198.51.100.53 something on port 53” and accepts the answer until a short timeout runs out.
Make sense so far? Because the next distinction is one exam writers love.
Stateful vs stateless firewall: what’s the difference?
A stateless firewall judges each packet against rules only. A stateful firewall also asks “is this part of a conversation I already approved?” So stateless rules have to permit return traffic explicitly, while stateful rules permit it automatically.
The cleanest real-world example lives in AWS, where you get one of each in every VPC. AWS’s own comparison table says it plainly (AWS: Infrastructure security in Amazon VPC):
| Security group | Network ACL | |
|---|---|---|
| Behaviour | Stateful: return traffic automatically allowed | Stateless: return traffic must be explicitly allowed |
| Applies to | Each instance | Whole subnet |
| Rule types | Allow only | Allow and deny |
| Evaluation | All rules, then decide | In order by rule number, first match wins |
That’s why AWS tells you to use security groups as the main control and NACLs as coarse, subnet-wide guard rails. It’s also why a NACL that “should work” can still break replies: it needs its own inbound rule for the client’s ephemeral ports.
Stateful isn’t free, though. The state table costs memory, and a flood of half-open connections can fill it. Stateful is better. It isn’t invincible.
What Is a Proxy Firewall?
A proxy firewall, or application-level gateway, never lets your packets reach the server. Your browser connects to the proxy. The proxy reads the request, decides whether it’s allowed, then opens a second connection to the server on your behalf. Two connections, with the proxy in the middle of both.
Because it terminates the connection, a proxy can read the application protocol itself: HTTP methods, URLs, FTP commands, file types. It also hides your internal addresses, since the server only ever sees the proxy. Squid is the textbook open-source example.
The trade-offs:
- One protocol at a time. A web proxy understands HTTP and HTTPS. Your DNS, SSH or SMB traffic needs another path or gets nothing.
- Slower. Building and tearing down two connections per request adds latency. Cisco’s own definition notes proxies can affect throughput.
- HTTPS is mostly opaque. Unless the proxy decrypts TLS, it sees the hostname in a
CONNECT somehost:443request and nothing after it. The worked example shows why that matters.
You’ll also hear “ALG” for router helpers that open pinholes for SIP or FTP. Related name, different job.
What Is a Circuit-Level Gateway?
A circuit-level gateway works at the session layer. It checks that a TCP session is set up legitimately, then relays bytes between the two sides without inspecting the content. SOCKS, defined in RFC 1928, is the example you’ll actually meet, usually as a proxy setting in a browser or an SSH client.
It’s lighter than a full proxy because it never parses the application. That’s also its weakness. Once the circuit is up, anything flows. In 2026 you’ll rarely buy one as a standalone product. It shows up as a feature, and as a favourite exam distractor.
What Is a Next-Generation Firewall (NGFW)?
A next-generation firewall is a stateful firewall that also identifies which application is talking, which user is behind it, and whether the traffic matches a known attack, often with TLS decryption so it can see inside HTTPS. Gartner defined the category in a 2009 research note, “Defining the Next-Generation Firewall”. Cisco’s definition puts it simply: it goes “beyond a traditional, stateful firewall” with application control, intrusion prevention and URL filtering (Cisco).
Here’s the thing that makes it “next generation”. A traditional firewall sees TCP 443 and assumes HTTPS. An NGFW looks at the traffic and decides for itself.
FortiGate is a good place to see this, and it’s what the NSE 4 exam tests. FortiOS 7.6 offers a policy-based NGFW mode, which Fortinet’s admin guide says needs flow-based inspection and is turned on like this:
config system settings
set ngfw-mode policy-based
end
In that mode you put applications straight into a security policy. Fortinet’s own example allows the HTTP.Audio application only on its default port:
config firewall security-policy
edit 1
set name "allow_HTTP.Audio"
set srcintf "port13"
set dstintf "port14"
set srcaddr "all"
set dstaddr "all"
set enforce-default-app-port enable
set action accept
set schedule "always"
set logtraffic all
set application 15879
next
end
The documented result: the same app on port 443 is allowed, and on port 8443 it’s blocked and logged as a port-violation (FortiOS 7.6.0 Administration Guide, “NGFW policy”). The firewall is judging the application, not the port number. A packet filter can’t do that. Neither can a plain stateful firewall.

Same port, different verdict. Both sessions use TCP 443, so a stateful firewall passes both. An NGFW identifies the second one as SSH and drops it. That’s packet 7 in the worked example below.
Want to see how FortiGate does all this in hardware and licensing terms? Our guide to what FortiGate is and how its NGFW works goes through it. Cisco’s version is Firepower Threat Defense, which is replacing ASA now that the ASA 5500-X series is past end of support.
NGFW vs UTM: is there a difference?
On paper, yes. Cisco describes a UTM as something that “loosely combines” stateful inspection with intrusion prevention and antivirus, aimed at simplicity. An NGFW is pitched at application and user awareness for bigger networks.
In practice? The same box often wears both labels depending on who’s selling it. A FortiGate with IPS, antivirus and web filtering licensed is both. For Security+, know that UTM means “many security functions in one appliance” and NGFW means “Layer 7, application-aware”. That’s the line the exam draws.
Where Do Web Application Firewalls and Cloud Firewalls Fit?
A web application firewall protects one web application, not a network. It usually sits in front of the app as a reverse proxy, terminates TLS, and reads every HTTP request for attacks like SQL injection and cross-site scripting. It won’t look at your SSH or DNS. It doesn’t care about them.
The common types of web application firewalls:
- By where it runs: network appliance (like FortiWeb), host module on the web server (like ModSecurity), or cloud service (like AWS WAF).
- By how it decides: blocklist (known-bad patterns) or allowlist (only the requests the app is known to accept), or a mix of both.
A cloud firewall is the same filtering types, delivered differently. In AWS you already have a stateful one (security groups) and a stateless one (NACLs) before you buy anything. For inspection, there’s AWS Network Firewall, or a virtual NGFW like FortiGate-VM. Firewall-as-a-Service (FWaaS) moves the whole thing to a provider’s cloud, which is where SASE products live.
How Do Different Types of Firewalls Handle the Same Packets?
Definitions blur together. Verdicts don’t. So here’s one small network, eight packets, and what five firewall types do with each.
The setup: inside network 10.1.0.0/16. A user’s laptop at 10.1.10.25, an RDP server at 10.1.20.40, and the company web app at 10.1.30.10, published on port 443. Outside addresses come from the documentation ranges (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24). The stateless column uses the exact WAN-IN ACL from earlier. The stateful firewall allows HTTPS and DNS out, plus the published web server in.

The worked example network. Inside is 10.1.0.0/16: the laptop at 10.1.10.25, the RDP server at 10.1.20.40, and the web app at 10.1.30.10 on port 443 behind a WAF. The laptop’s HTTPS goes out (turquoise). A forged packet like packet 3 stops at a stateful firewall (X); a stateless ACL would let it through.
| # | Packet | Stateless ACL | Stateful | Proxy | NGFW | WAF |
|---|---|---|---|---|---|---|
| 1 | Laptop opens HTTPS to 203.0.113.80 | Pass | Pass | Relay | Pass | n/a |
| 2 | Server’s SYN-ACK back to the laptop | Pass | Pass | Relay | Pass | n/a |
| 3 | Forged ACK from 192.0.2.66 to the RDP server, TCP 3389 | Pass | Drop | Drop | Drop | n/a |
| 4 | Laptop’s DNS query to 198.51.100.53 | Pass | Pass | Drop | Pass | n/a |
| 5 | DNS answer back to the laptop | Pass | Pass | Drop | Pass | n/a |
| 6 | Spoofed “DNS” packet to the RDP server, UDP 3389 | Pass | Drop | Drop | Drop | n/a |
| 7 | SSH session from the laptop, tunnelled on TCP 443 | Pass | Pass | Relay (CONNECT) | Drop (app ID) | n/a |
| 8 | SQL injection in a form post to the web app | Pass | Pass | n/a | Drop (IPS)* | Block |
\*Only if the NGFW decrypts inbound HTTPS to that server. Without decryption it passes.
This is modelled, not captured on a lab box. We scripted each type’s documented decision rule and ran the eight packets through it, so every verdict came out of code, not memory. Here’s what to take from it.
Packet 3 is why established isn’t a firewall. The forged ACK reaches the RDP server. It can’t open a session there, because the server just answers with a reset. But that reset tells the sender the host exists and that your ACL lets ACK packets through. That’s exactly how an ACK scan maps a packet filter.
Packet 6 is the UDP version, and narrowing doesn’t fix it. Say you tighten line 20 to the Windows client range. Since Vista, Windows picks client ports from 49152 to 65535 (Microsoft). Packet 6, aimed at 3389, now gets dropped. Aim the same spoof at UDP 50000 and it walks in. You’ve cut the hole from 64,512 ports to 16,384. Linux clients don’t help either: a stock Ubuntu 24.04 server reports 32768 to 60999, another 28,232 ports.
Packets 4 and 5 show the proxy’s blind spot. With an explicit web proxy, the proxy resolves names itself, so the laptop’s own DNS has nowhere to go. Anything that isn’t web traffic needs another path.
Packet 7 is why “stateful” isn’t the end of the story. The stateful firewall sees TCP 443 to the internet and lets it go. A forward proxy that doesn’t decrypt TLS relays the CONNECT tunnel blind. Only the NGFW notices the conversation is SSH, not HTTPS.
Packet 8 is why WAFs exist. The web app has to accept HTTPS from everyone, so every layer-4 firewall waves the attack through. The WAF reads the decrypted request and blocks the injection. An NGFW can too, but only if you load the server’s certificate and decrypt.
So each type closes a gap the one before it left open. That’s why real networks stack them.
Hardware vs Software Firewall: Which One Do You Need?
A hardware firewall is a dedicated appliance with its own processors, sitting in the traffic path and protecting everything behind it. A software firewall is a program: either a full firewall running as a VM, or a host firewall protecting the one machine it’s installed on.
| Hardware firewall | Software firewall | |
|---|---|---|
| Protects | A whole network or site | One VM’s networks, or one host |
| Throughput | Built for it, often with security chips | Limited by the host’s CPU |
| Cost | Upfront appliance plus licences | Often free on hosts, licensed as VMs |
| Best for | Office edge, data centre, branch | Cloud, labs, laptops, servers |
You’ll want both. The edge appliance stops most junk before it lands. The host firewall protects the laptop when it’s on hotel Wi-Fi, and slows down an attacker who’s already inside.
For your lab, software wins. You can run FortiGate-VM inside EVE-NG and practise the FortiGate policies in this article without buying a box.
What is a host-based firewall?
A host-based firewall runs on the computer it protects. Windows Firewall is the one you already have. Linux uses nftables (or iptables) with connection tracking, and macOS has its own application firewall. These are the “personal firewalls” older textbooks talk about. Nearly all of them are stateful, which is why your laptop doesn’t need an inbound rule for every website you visit.
What Are Some Examples of Firewalls?
Here’s how real products map to the types. Most commercial boxes span several rows, so read this as “what it’s mainly used as”.
| Type | Examples |
|---|---|
| Packet filtering | Cisco IOS/IOS XE extended ACLs, AWS network ACLs |
| Stateful | AWS security groups, Windows Firewall, nftables/iptables, pfSense and OPNsense |
| Proxy | Squid, the explicit web proxy on FortiGate |
| Circuit-level | SOCKS servers |
| NGFW (hardware firewall examples) | FortiGate appliances, Cisco Secure Firewall running FTD, Palo Alto Networks PA-Series |
| Cloud firewall examples | AWS Network Firewall, Azure Firewall, FortiGate-VM, FortiGate CNF |
| WAF | AWS WAF, FortiWeb, ModSecurity |
Which Types of Firewalls Show Up on CCNA, Security+ and NSE 4?
All three exams test this topic, but each wants something different. Here’s exactly what the current blueprints say, checked on 2026-10-22.
| Exam | Where | What it asks | What to study here |
|---|---|---|---|
| CCNA 200-301 v1.1 | 1.1.c “Next-generation firewalls and IPS”; 5.6 “Configure and verify access control lists” (Cisco blueprint PDF) | Role of an NGFW; writing ACLs | Packet filtering section, the WAN-IN ACL, NGFW section |
| Security+ SY0-701 | 3.2, firewall types: WAF, UTM, NGFW, Layer 4/Layer 7 (exam objectives v5.0) | Pick the right type for a scenario | NGFW vs UTM, WAF, the worked example |
| NSE 4 – FortiOS 7.6 Administrator | “Firewall policies and authentication” 20-25%; “Content inspection” 25-30% (SSL inspection, web filtering, application control, antivirus, IPS) | Configure policies and security profiles on FortiGate | NGFW section, then hands-on labs |
Two date notes. CompTIA says Security+ V8 is “expected to launch on or around November 17, 2026” (CompTIA), so check which version you’re booking. On the Fortinet side, NSE 4 on FortiOS 7.6 is the bookable exam, and the FortiOS 8.0 version is still listed as “Coming Soon” on Fortinet’s training site. Our NSE certification changes guide tracks that.
Notice the pattern? Security+ wants you to name the type. NSE 4 wants you to build it. Those two NSE 4 domains add up to 45-55% of the exam, and most of it is NGFW work: policies, NAT, SSL inspection, application control, IPS. Reading about application control won’t get you there. Configuring it, breaking it and reading the logs will. That’s what our FortiGate NSE 4 lab workbook is built around: labs for firewall policies, NAT, security profiles (AV, IPS, web filtering and application control), VPN, SD-WAN and HA, all built to run in EVE-NG. Keep the FortiGate CLI commands PDF open while you do.
Going the Cisco route instead? The Cisco ASA commands PDF covers the classic stateful firewall CLI, and the CCIE Security workbook is the long road from there. For Security+, test yourself with our 80-question Security+ practice test.
Which Type of Firewall Should You Use?
Use this as the rule of thumb:
- Between internal segments, or as a coarse guard rail on a router: packet filtering ACLs. Know their limits.
- Anything facing the internet: stateful at minimum. Never a bare ACL.
- Users browsing out, where you need app control, TLS inspection or IPS: an NGFW.
- A public web application: a WAF in front of it, plus a stateful or NGFW layer for everything else.
- Cloud workloads: security groups on every instance, NACLs as subnet guard rails, and AWS Network Firewall or a virtual NGFW where you need inspection.
- Every laptop and server: leave the host firewall on.
If you’re not sure where you’d place each one, sketch it against the OSI model cheat sheet and the common ports cheat sheet. The layer each type reads tells you what it can and can’t stop.
Frequently Asked Questions
What are the 3 types of firewalls?
The classic three are packet filtering, stateful inspection and application-level gateway (proxy). They’re sorted by how much each one reads: headers only, headers plus connection state, or the application data itself. Most current lists add circuit-level gateways and NGFWs to make five.
What are the two main types of firewall?
When people say “two main types”, they usually mean hardware vs software firewalls, or network-based vs host-based. A network firewall protects everything behind it. A host-based firewall, like Windows Firewall, protects only the machine it runs on. Most networks use both.
What are the 4 major types of firewalls?
The traditional four are packet filtering, circuit-level gateway, application-level gateway (proxy) and stateful multilayer inspection. That list predates the NGFW, which today combines stateful inspection with application awareness and intrusion prevention.
Are firewalls a type of IPS?
No. A firewall decides which connections are allowed. An IPS inspects allowed traffic for attacks and blocks the bad parts. They’re separate functions, but most NGFWs ship an IPS engine inside, which is why the line blurs. Our IDS vs IPS guide covers where each one sits.
Is NAT a firewall?
Not really, though it behaves a bit like one. NAT keeps a translation table, so unsolicited inbound traffic has nowhere to go. That’s a side effect, not a policy. NAT is stateful too, but you still want a real stateful firewall with rules you wrote on purpose.
What are the types of web application firewalls?
By deployment, there are network-based WAFs (appliances like FortiWeb), host-based WAFs (modules like ModSecurity on the web server) and cloud-based WAFs (services like AWS WAF). By logic, they use a blocklist of known attack patterns, an allowlist of known-good requests, or a mix of both.
Bottom line
- Five types by filtering method: packet filtering, stateful inspection, circuit-level gateway, proxy and NGFW. WAF, UTM and cloud firewalls build on them.
- Stateless filters trust two TCP bits.
establishedmatches 48 of 64 flag combinations, so it isn’t a substitute for state. - Stateful firewalls fix return traffic but still trust the port number. NGFWs identify the application. WAFs read the web request.
- For NSE 4, this isn’t theory. Firewall policies and authentication plus content inspection are 45-55% of the exam.
Want to practise it, not just read it? The FortiGate NSE 4 lab workbook walks you through FortiGate firewall policies and security profiles on a FortiGate-VM in EVE-NG, one lab at a time.