What Is a Firewall? Types, How It Works, and Real Examples (2026 Guide)

Learn what a firewall is, how it filters traffic, the main firewall types, and how FortiGate and Palo Alto use them in real networks.

Every device connected to the internet receives traffic it never asked for. A firewall is the checkpoint that decides which traffic is allowed in or out of your network. This guide explains how firewalls work, the main types, and where you will meet them in real networks, whether you are protecting a home router or a company built on FortiGate or Palo Alto.


What Is a Firewall?

A firewall is a security device or program that monitors network traffic and allows or blocks it based on a set of rules. Think of a guard at a building entrance who checks every visitor against an approved list.

How a Firewall Works

Each packet is compared with an ordered list of rules. Rules usually look at:

  • Source and destination IP address
  • Port number (for example 443 for HTTPS)
  • Protocol (TCP, UDP, ICMP)
  • Sometimes the application, user, or website category

The first matching rule decides the action: allow or deny. If nothing matches, the implicit deny rule blocks the packet. This is why rule order matters so much in FortiGate and Cisco firewall policies.

Types of Firewalls

  1. Packet-filtering firewall: checks each packet on its own using IP and port. It is fast but has no memory of connections.
  2. Stateful inspection firewall: tracks the state of every connection, so replies to traffic you started are allowed while unsolicited inbound traffic is blocked. Most modern firewalls work this way.
  3. Proxy (application-layer) firewall: sits between users and the internet and inspects traffic at the application level. It is more thorough but slower.
  4. Next-Generation Firewall (NGFW): adds application awareness, intrusion prevention (IPS), URL filtering, and malware scanning. FortiGate and Palo Alto devices are NGFWs.
  5. Web Application Firewall (WAF): protects websites from attacks such as SQL injection and cross-site scripting.

Hardware vs Software Firewalls

Hardware firewallSoftware firewall
LocationNetwork edge applianceInstalled on one device
ProtectsThe whole networkA single computer
ExamplesFortiGate, Palo AltoWindows Defender Firewall

Where a Firewall Sits in a Network

A typical layout is: Internet → Firewall → Switch → Internal devices. Many networks also create a DMZ, a separate zone for public-facing servers, so a compromised web server cannot reach internal systems.

Simple Firewall Policy Example

SourceDestinationServiceAction
LANInternetHTTP, HTTPS, DNSAllow
InternetLANAnyDeny
Admin PCFirewallSSHAllow

Firewall Best Practices

  • Follow the principle of least privilege: allow only what is needed.
  • Review and remove unused rules regularly.
  • Enable logging on important policies.
  • Keep firmware up to date.
  • Never expose management access (HTTPS/SSH) to the internet.

Frequently Asked Questions

Is a firewall the same as antivirus? No. A firewall controls network traffic, while antivirus scans files and programs for malware. You need both.

Do I need a firewall at home? Your home router already has a basic firewall. Keep it enabled and keep the router firmware updated.

What is the difference between stateful and stateless? A stateless firewall judges each packet alone, while a stateful firewall remembers connections and judges packets in context.

Conclusion

A firewall is the first line of defense in any network. Once you understand rules, zones, and stateful inspection, learning any vendor's firewall becomes much easier. Next, we will look at the OSI model, which explains at which layer each of these checks happens.

Related reading: DNS vs DHCP vs NAT Explained · Configure DHCP Server and Firewall Policy in FortiGate

NextGen Digital... Welcome to WhatsApp chat
Howdy! How can we help you today?
Type here...