Security operations

Firewall Security Explained: Types, Rules, and Best Practices

A firewall is the gatekeeper between your network and the internet — but only if it is switched on, patched, and its rules are reviewed. Here is how the types compare and what to check.

Cysoro Security TeamPublished · 10 min read
ALLOW 443 HTTPSBLOCK 22 SSHALLOW 53 DNSBLOCK ALL ELSE SECURITY OPERATIONS Firewallsecurity Block by default. Review the rules.
Quick answer

Firewall security is the control of network traffic between networks or hosts with different security postures, using rules that allow or block each connection. A firewall should block by default whatever its rules do not expressly permit. Modern firewalls range from simple packet filters to next-generation firewalls that inspect applications and block intrusions, and they only work when they are patched, their rules are reviewed, and their management interfaces are kept off the internet.

Key takeaways

  • A firewall allows or blocks traffic by rule, and the safest default is to block everything not expressly allowed.
  • Patch firewalls fast and review rules at least every six months — edge devices are a top target for attackers.
  • Use two layers: a network firewall at the edge and a host firewall on every laptop and server.

Every device on the internet is constantly probed. Scans, connection attempts, and login tries arrive whether you invite them or not. A firewall is the gatekeeper that decides, packet by packet, what gets through — and most homes and small businesses already own one without knowing it.

What is firewall security?

Firewall security is the control of network traffic between networks or hosts with different security postures. A firewall allows or blocks each connection against a set of rules, and it should block by default whatever the rules do not expressly permit.

NIST defines a firewall in SP 800-41 Rev. 1 as a device or program that controls the flow of network traffic between networks or hosts that employ differing security postures, and recommends treating it as a foundational security control, not an optional add-on. CISA puts it more plainly for home and small-office users: firewalls can be configured to block data from certain network addresses, applications, or ports while still letting necessary, legitimate traffic through.

In practice, a firewall sits at a boundary — between your home network and the internet, between office segments, or on a single laptop — and checks every connection against its rulebook. If the traffic matches an allow rule, it passes. If it does not, it is dropped, and the attempt is usually logged.

How does a firewall work?

A firewall inspects traffic as it crosses a boundary and applies its rules in order. The first rule that matches usually decides, so rule order matters as much as the rules themselves.

A firewall typically looks at where traffic comes from and where it is going, which port it uses, which protocol it speaks, whether it belongs to a conversation you started, and, on more advanced firewalls, which application it belongs to. A simple example is port 443 for HTTPS: a firewall can allow outbound web traffic on 443 while blocking inbound connections to a port nobody needs.

The safest default is called default deny: anything not explicitly allowed is blocked. That is the opposite of the common mistake of allowing everything and blocking only known bad traffic, which leaves every unknown threat open by default.

How a firewall decides what gets throughInternetuntrusted trafficFirewallchecks rulesin orderYour networktrusted devices→→Allowed: matches an allow rulefor example, a reply to your web requestBlocked: no allow rule matchesdefault deny — log it and drop it
A firewall checks traffic against its rules in order, and default deny blocks anything not expressly allowed. Illustration by Cysoro.

What are the main types of firewall?

Firewall technology has evolved in layers since the 1980s, and most earlier approaches are still in use, often combined inside a single product. The main types differ in how deeply they inspect traffic.

TypeWhat it inspectsStrengthsLimitations
Packet-filteringPacket headers: IP, port, protocolFast, simple, low overheadNo connection or content awareness
Stateful inspectionHeaders plus connection stateBlocks unsolicited trafficLimited content inspection
Proxy / application-levelFull application contentDeep control, hides internal hostsSlower, protocol-specific
Next-generation (NGFW)Applications, users, threatsGranular policy, intrusion preventionCost, complexity, encrypted traffic
Web application (WAF)HTTP requests and responsesBlocks web attacks such as SQL injectionWeb traffic only, needs tuning
Host-basedTraffic on one deviceProtects laptops off-siteMust be managed on every device

Packet-filtering firewalls are the oldest and simplest: they check each packet's source and destination IP, port, and protocol against a list. Stateful firewalls add memory, tracking active connections in a state table so they can tell whether a packet belongs to a session you already allowed.

Proxy or application-level firewalls act as an intermediary, ending the connection and inspecting the actual application content. Next-generation firewalls combine stateful inspection with application awareness, deep packet inspection, intrusion prevention, and often TLS decryption. A web application firewall sits in front of web servers and is often considered very different from a traditional firewall, because it understands HTTP attacks rather than network traffic in general.

By deployment, firewalls can be network appliances, host-based software on each device, or cloud services. A cloud firewall as a service, and secure access service edge (SASE), deliver firewall functions from the cloud, which suits remote and hybrid teams.

Hardware vs software firewalls: which do you need?

You need both. CISA's guidance for home and small offices breaks firewalls into two broad models, and recommends keeping the software firewall enabled even if a hardware firewall is also present upstream.

Hardware firewalls are physical devices placed between your equipment and the internet. Many consumer and small-office routers include built-in firewall features, which makes them well suited to protecting several devices on a network at once. The tradeoff is that they are a separate piece of equipment that typically needs some technical knowledge to configure and maintain.

Software firewalls run directly on the device they protect. Most operating systems ship with one already built in, and a software firewall can control network access on a per-application basis. Its weakness is that it runs on the same system it is defending, so it can be less effective if that system is already compromised.

The two layers cover each other's gaps. The network firewall protects the office as a whole. The host firewall protects each laptop when it leaves the office and connects to hotel, airport, or coffee shop Wi-Fi. For a home network, the router firewall plus the built-in firewall on each computer is a solid baseline, and our guide to how to secure your Wi-Fi covers the router settings that go with it.

Why are firewalls a top target for attackers?

Firewalls are a prime target because they face the internet, often carry VPN access, and have extensive reach into the network. Joint guidance published in February 2025 by Canada's cyber security agency, with contributions from CISA and agencies in Australia, New Zealand, and the UK, says targeting edge devices has become a tactic of choice for many threat actors, including state-sponsored ones.

The numbers show the shift. Verizon's 2025 Data Breach Investigations Report found that edge devices and VPNs accounted for 22 percent of vulnerability exploitation in breaches, up from 3 percent a year earlier. Only 54 percent of edge device vulnerabilities were fully remediated during the year, and the median time to fully remediate one was 32 days.

Firewall flaws were added to CISA's Known Exploited Vulnerabilities catalog in 2024, 2025, and 2026. Examples include a Fortinet FortiOS flaw from February 2024 that let a remote, unauthenticated attacker execute code, and a Palo Alto Networks PAN-OS GlobalProtect flaw from April 2024 that let an unauthenticated attacker execute commands with root privileges. In September 2025, a Cisco Secure Firewall flaw led to an emergency directive for federal agencies.

The lesson is not that firewalls are useless. It is that an unpatched firewall is worse than no firewall at all in one respect: it gives you confidence while attackers have a known way in. Patching is part of firewall security, not an afterthought.

Firewall rules: how to write and review them

Good firewall rules are specific, ordered, and reviewed. NIST SP 800-41 says the firewall policy belongs in the system security plan and should be updated as new classes of attack appear or application needs change, with rulesets going through formal change management and periodic review.

Follow these principles when you write rules:

  • Default deny: block everything, then allow only what you need, by specific source, destination, and port.
  • Least privilege: use specific addresses and ports, not any to any, and open a port only for the device that needs it.
  • Order matters: firewalls usually apply the first rule that matches, so put specific rules before general ones.
  • Document every rule: note who asked for it, why, and when it should expire. A rule nobody can explain is a rule to remove.
  • Review routinely: PCI DSS requires network security controls to be reviewed at least once every six months. Joint edge-device guidance asks for two or more people to review a change before it is made.

Common rule mistakes are easy to spot: an allow rule for a temporary test that was never removed, a wide-open port for remote access, a rule that allows a whole country or a whole IP range when one address would do, and inbound rules that were copied from a template without being checked. A quarterly review that removes unused rules is one of the highest-value security tasks a small team can do.

Firewall rule hygiene in five checks1. Default denyblock everything not expressly allowed— no allow-all rules2. Least privilegespecific source, destination and port,never any-to-any3. Order and documentationspecific rules first; every rule hasan owner, a reason and an expiry4. Review every six monthsPCI DSS minimum; two reviewersfor every change
Five checks that keep a firewall ruleset tight: deny by default, least privilege, order, documentation, and review. Illustration by Cysoro.

How do you harden and patch a firewall?

Hardening a firewall is mostly about reducing its exposure and keeping it updated. The February 2025 joint guidance on edge devices lists the mitigations that matter most, and they are straightforward to apply.

  1. Patch as quickly as possible after testing on a standby or test device, on an automated or monitored schedule. Do not let a firewall sit unpatched for weeks.
  2. Keep management interfaces off the direct internet. Admin access should only be reachable from a trusted network or through a VPN, never from any IP on the internet.
  3. Require phishing-resistant MFA for all administrative access. A password alone is not enough for a device that guards your whole network.
  4. Send logs off the device to a central store, at the most detailed level available, so an attacker cannot delete the evidence of their own attack.
  5. Keep an inventory of edge devices with their support timelines, and replace devices before support ends. A February 2026 US binding operational directive gives federal civilian agencies 18 months to decommission end-of-support edge devices.
  6. Turn off unused services and ports on the firewall itself, including remote management protocols you do not use.

For a small business, the simplest version is: enable automatic updates or check weekly, change the default admin password, turn on MFA, and never expose the admin page to the internet. Those four steps close the most common ways firewalls are compromised.

What a firewall cannot do

A firewall is one layer, not a complete defense. It cannot protect against attacks that do not cross it, or against attacks hidden in traffic it is told to allow.

It cannot stop phishing, because a phishing email arrives through allowed email and web traffic, and the damage happens when a person clicks and logs in. It cannot stop malware that a user downloads, or an insider who is already inside the network. It cannot inspect encrypted traffic unless it is configured for TLS inspection, and even then it needs careful setup and privacy consideration.

NIST noted as early as 2009 that attacks sent from one internal host to another often do not pass through network firewalls, which is why designers were already placing firewall functions away from the perimeter. Segmentation inside the network, host firewalls, endpoint protection, and email security all matter alongside the perimeter firewall.

Think of it as a locked front door. It stops casual intruders and forces attackers to find another way in, but it does not stop someone you invite inside, and it does not help if a window is left open. For a wider starting point, our small business cybersecurity checklist covers backups, updates, and device security alongside firewall controls.

How do you choose a firewall for a small business?

Choose by what you need to protect, not by the biggest throughput number on a datasheet. Vendor throughput figures are measured with different traffic mixes and feature sets, so they do not compare across vendors, and turning on threat inspection can cut throughput sharply.

  • Home or very small office: the firewall in your router, plus the built-in host firewall on every device, is usually enough. Keep both on and updated.
  • Small business with a server or remote workers: a dedicated NGFW or unified threat management device adds application control, intrusion prevention, and VPN in one box.
  • Cloud-first business: a cloud firewall or firewall-as-a-service protects cloud workloads and remote users without a physical appliance.
  • Public website: add a web application firewall in front of the site, and check its headers with our free security headers checker.

Before you buy, check the vendor's support timeline, the cost of security subscriptions on top of the hardware, and whether the device can handle your internet speed with threat inspection turned on. A firewall that is too slow will be turned down or bypassed, which defeats the purpose.

The bottom line

Firewall security is not about buying the most expensive box. It is about a simple rule — block everything you do not need — applied consistently, patched quickly, and reviewed every six months.

Turn on the firewall in your router and on every device, keep management access off the internet and behind MFA, and review your rules for anything too broad or unexplained. If you run a public website, start with our free SSL checker to see whether its basic protections are in place.

Frequently asked questions

What is firewall security?

Firewall security is the practice of controlling network traffic with a firewall, a device or program that allows or blocks connections based on rules. It includes choosing the right firewall type, writing tight rules, patching the device, and reviewing those rules regularly.

Do I need a firewall if I already have antivirus?

Yes. Antivirus catches malware on a device, while a firewall controls which network traffic can reach that device in the first place. They do different jobs, and you need both.

What is the difference between a hardware and a software firewall?

A hardware firewall is a physical device between your network and the internet, and it protects several devices at once. A software firewall runs on one device, such as a laptop, and can control traffic per application. CISA recommends keeping both enabled.

What is a next-generation firewall?

A next-generation firewall combines stateful inspection with application awareness, deep packet inspection, intrusion prevention, and often TLS inspection. NIST SP 800-215 defines it by its ability to read traffic at layer 7 as well as layers 3 and 4.

How often should firewall rules be reviewed?

PCI DSS requires network security controls to be reviewed at least once every six months. Joint guidance on edge devices asks for rules to be reviewed routinely, more often on a dynamic network, with two or more people reviewing a change before it is made.

Can a firewall be hacked?

Yes. Firewalls are a prime target because they face the internet and often carry VPN access. Firewall flaws were added to CISA's Known Exploited Vulnerabilities catalog in 2024, 2025, and 2026, which is why fast patching matters.

Does a firewall protect against phishing?

No, not directly. A firewall can block a malicious site or a known bad address, but it cannot stop you from clicking a phishing link or entering your password on a fake page. That needs email security, browser protection, and training.

Should I turn off my firewall for gaming or streaming?

No. Turning a firewall off removes a basic layer of protection. If a game or app needs a port, open only that port, for only the device that needs it, and close it again when you are done.

Sources

  1. Pandromeda — What Is a Firewall in Cyber Security? [2026]
  2. LocalEdgeIT — Network Firewalls: What Every Small Business Needs to Know
  3. CIO Pages — Firewall Security: NGFW, Edge Risk, Rule Review, Cost
  4. Verizon — 2025 Data Breach Investigations Report
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against NIST SP 800-41 Rev. 1, CISA's firewall guidance for home and small offices, and Verizon's 2025 DBIR.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free