What Is a Firewall? How It Works and Why You Need One
A firewall is the most fundamental piece of network defense — and one of the most misunderstood. Let’s demystify what it actually does and why, decades after it was invented, it’s still everywhere.
The simple definition
A firewall is a device or software that controls which network traffic is allowed in and out, based on a set of rules. Think of it as a security guard at the boundary between your trusted network and the untrusted internet, checking every packet against a policy of “allow” or “deny.”
How a firewall decides
Firewalls inspect traffic and make decisions based on attributes like:
- Source and destination IP address (who’s talking to whom)
- Port and protocol (e.g. TCP port 443 for HTTPS, UDP 53 for DNS)
- Direction (inbound vs outbound)
- Connection state (is this part of an existing, legitimate conversation?)
Rules are usually evaluated top to bottom, and most firewalls end with an implicit “deny everything else.” That “default deny” posture is the heart of good firewall design: allow only what you explicitly need, block the rest.
The main types
1. Packet-filtering (stateless) — the original. It checks each packet in isolation against rules. Fast, but it doesn’t understand the context of a conversation.
2. Stateful firewalls — the standard for years. They track the state of connections, so if you make an outbound request, the matching reply is automatically allowed back in. This is smarter and more secure than stateless filtering.
3. Next-Generation Firewalls (NGFW) — modern firewalls that add deep inspection: application awareness (it knows it’s Zoom traffic, not just “port 443”), intrusion prevention (IPS), URL filtering, and even decrypting and inspecting encrypted traffic.
A simple rule example
A basic policy for a web server might say:
- Allow inbound TCP 443 (HTTPS) and 80 (HTTP) from anywhere
- Allow inbound TCP 22 (SSH) only from the admin’s IP
- Deny everything else inbound
That last line — the default deny — is what makes it secure. You’re not listing what to block; you’re listing the tiny set of things to allow.
Why firewalls still matter
People sometimes claim firewalls are obsolete in a cloud, zero-trust world. They’re not — they’ve evolved. Whether it’s a hardware appliance at the network edge, a host-based firewall on a server, or a cloud security group, the core idea is unchanged and essential: enforce a boundary, and allow only what’s necessary. Most breaches involve something that should have been blocked but wasn’t.
Common firewall mistakes
- “Allow any” rules that quietly permit far more than intended
- Leaving management ports (like SSH or RDP) open to the whole internet
- Rules that are never cleaned up, creating a tangled, risky policy over time
Learn to configure one yourself
Reading about firewalls is one thing; writing rules and watching them block (or accidentally allow) real traffic is where it clicks. On Learn.GT, you can configure firewalls and next-gen firewall features in hands-on labs, and see exactly how policy decisions play out. Pair it with cybersecurity fundamentals to understand the attacks you’re defending against.
A firewall is simple in concept and deep in practice. Master the “default deny” mindset, and you’ve already got the most important security instinct there is.