---
title: "Types of Network Firewalls | FiveStudy"
description: "What firewalls do, and how stateless, stateful, and next-generation firewalls differ in reading packet headers, tracking connections, and inspecting content and applications."
url: https://fivestudy.com/guides/ap-cybersecurity-3-4-a-types-of-network-firewalls
---

[AP Cybersecurity](https://fivestudy.com/ap-cybersecurity) · Study guide

# Types of Network Firewalls

[Figure: FiveStudy]

FiveStudy

AP® Cybersecurity · Unit 3 · Network Security, Firewalls & Detection

AP® Cybersecurity · Unit 3 · Network Security, Firewalls & Detection

# Types of Network Firewalls

What a firewall is, and how stateless, stateful, and next-generation firewalls differ in what they can see and decide.

1. What a firewall is 2. Packets, ports, and protocols 3. Stateless firewalls 4. Stateful firewalls 5. Next-generation firewalls 6. Comparing them 7. Worked examples 8. Common mistakes

## 1 What 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.

## 2 Packets, ports, and protocols

Data travels across networks in small pieces called **packets**. Each packet has a **header** (addressing information) and a **payload** (the content).

**Figure 1.** Like reading the address on an envelope versus opening it: header filtering is fast; inspecting the payload catches more but takes more work.

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) |

## 3 Stateless 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.

## 4 Stateful 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.

## 5 Next-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.

## 6 Comparing them

**Figure 2.** Moving up adds more context: from single packets, to whole connections, to the content and the application itself.

| 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 |

The key idea

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.

## 7 Worked examples

Worked Example 1 Pick the type

### 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?

1. 1

   A stateless firewall looks at each packet's header alone; a well-forged reply looks like any other reply.

2. 2

   A stateful firewall tracks which conversations were started from inside. These packets match no conversation, so it drops them.

**Answer:** A stateful firewall (or an NGFW, which includes stateful tracking).

Worked Example 2 Pick the type

### 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?

1. 1

   Blocking port 443 would block every secure website: not acceptable.

2. 2

   Stateless and stateful firewalls see the port and connection, not which application is using it.

3. 3

   An NGFW can filter by application type, identifying and blocking that app while allowing other port-443 traffic.

**Answer:** A next-generation firewall, using application filtering.

Worked Example 3 Pick the type

### 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?

1. 1

   The header shows an allowed address, port 443, and TCP, so stateless and stateful firewalls let it through.

2. 2

   Catching it requires looking inside the content.

3. 3

   An NGFW with deep packet inspection (and the ability to inspect the encrypted traffic) can scan the file and block known malware.

**Answer:** A next-generation firewall, using deep packet inspection.

Worked Example 4 Where firewalls live

### 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?

1. 1

   A firewall is software that allows or denies traffic.

2. 2

   It can run on a standalone device or be integrated into another device like a router.

3. 3

   What matters is the type (stateless, stateful, NGFW) and the rules, not the box it runs on.

**Answer:** Yes. Both are firewalls; they differ in where the software runs and in capabilities.

## 8 Common mistakes

Common Mistake 1 · Thinking a firewall is always a separate box

A firewall is software. It may run on its own device or inside a router.

Common Mistake 2 · Mixing up stateless and stateful

Stateless: each packet alone, by header. Stateful: remembers connections and filters by connection state too.

Common Mistake 3 · Expecting a basic firewall to catch malware in files

Header-based firewalls cannot see content. Deep packet inspection, a next-generation feature, looks inside.

Identify a firewall type like this

“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.

FiveStudy AP® Cybersecurity · Types of Network Firewalls
