Skip to main content

Blog

What Is a Firewall and How Does It Actually Work? A Practical Guide for Students

Firewalls are one of the most talked-about and least understood tools in networking. Here's a clear, practical breakdown of how they actually filter traffic, from basic packet filters to modern next-gen firewalls.

Firewall network security concept illustration

Almost every student hears the word "firewall" before they ever touch a real network device, and most picture something like a wall of fire blocking hackers. The reality is both simpler and more interesting: a firewall is a system that decides, traffic packet by traffic packet, what's allowed in and out of a network based on a defined set of rules.

The Core Idea: Traffic Filtering by Rules

At its simplest, a firewall sits between two networks - commonly a trusted internal network and the untrusted public internet - and inspects every packet trying to cross that boundary. Based on a rule set (often called an Access Control List, or ACL), it makes one of three decisions for each packet: allow, block, or log and alert.

The Evolution of Firewall Technology

1. Packet-Filtering Firewalls (the original type)

These inspect each packet in isolation, checking basic header information - source IP, destination IP, source port, destination port, and protocol - against a static rule list. They're fast and simple, but have no memory of previous packets, so they can't tell if a packet is part of a legitimate, already-established conversation.

2. Stateful Inspection Firewalls

These track the state of active connections in a table, so once a connection is legitimately established (e.g. an internal device requested a webpage), return traffic for that specific conversation is automatically allowed back through - without needing a separate rule for every possible reply. This became the industry standard for years and is still the core mechanism inside most enterprise firewalls today.

3. Next-Generation Firewalls (NGFW)

Modern firewalls go far beyond ports and IPs - they inspect the actual content of traffic at the application layer, identify specific applications regardless of the port they use, integrate intrusion prevention, and can even decrypt and inspect HTTPS traffic for hidden threats. Products like Cisco Firepower, Palo Alto Networks, and Fortinet FortiGate are widely deployed NGFWs in real enterprise environments.

Practical Example: imagine a small company office network. The firewall rule set might say: allow all outbound web traffic (port 443) from any internal device; allow inbound traffic only to the public web server on port 443; block every other inbound connection by default; and specifically allow the accounting team's IP range to reach the finance server on port 3306, while blocking that same port from every other department. This is exactly how a real, working firewall policy is structured in practice - a short list of explicit allows, with everything else denied by default.

Types of Firewall Deployment

  • Network firewalls: hardware or virtual appliances that protect an entire network segment (e.g. at the edge of a company's internet connection).
  • Host-based firewalls: software running on an individual device (like Windows Defender Firewall) protecting just that machine.
  • Web Application Firewalls (WAF): specialized firewalls that sit in front of web applications specifically, filtering malicious HTTP requests like SQL injection or cross-site scripting attempts.
  • Cloud-native firewalls: security-group and network-ACL constructs inside AWS, Azure, or GCP that apply the same filtering logic to cloud resources.

The "Default Deny" Principle

The single most important concept in firewall configuration is default deny: block everything by default, and only explicitly allow the specific traffic that's actually needed. This is the opposite of how many beginners initially configure a firewall (allowing everything and trying to block "bad" traffic), and it's the difference between a firewall that actually reduces risk and one that gives a false sense of security.

What a Firewall Cannot Do

  • It cannot stop an attack that comes from a legitimate, already-open port (e.g. malicious content hidden inside allowed HTTPS traffic) unless it has deep inspection capability.
  • It cannot stop social engineering, phishing, or an attacker using stolen valid credentials to log in normally.
  • It cannot protect against threats that originate from inside the trusted network already, unless internal segmentation rules are also configured.

This is exactly why modern security design layers firewalls together with endpoint protection, monitoring, and identity controls rather than relying on the firewall alone - a theme covered in more depth in our Zero Trust article.

Key Takeaways

  • A firewall filters traffic based on rules, deciding what's allowed to cross a network boundary.
  • Firewalls evolved from simple packet filters, to stateful inspection, to today's deep-inspecting next-generation firewalls.
  • "Default deny" - block everything, explicitly allow only what's needed - is the core principle of a strong firewall policy.
  • A firewall is one layer of defense, not a complete security solution on its own.

Related

Continue reading.