A network security firewall is a device or program that controls traffic between networks with different security postures, allowing only traffic your rules permit and blocking the rest. It inspects source and destination addresses, ports and protocols, and modern next-generation firewalls also inspect applications, users and content. The safest starting rule is default deny: block everything, then open only what your business actually uses.
Key takeaways
- A firewall allows or blocks each connection against rules; default deny is the safest starting point.
- Stateful, next-generation and web application firewalls inspect traffic at different depths.
- A firewall is one layer: it cannot stop insider attacks, phishing or malware in allowed traffic.
Every device on your network is constantly exposed to unsolicited traffic — scans, probes and connection attempts from addresses it has never talked to. A network security firewall is the gatekeeper that decides, connection by connection, what gets through and what gets dropped.
What is a network security firewall?
A network security firewall is a device or program that controls the flow of network traffic between networks or hosts with different security postures, allowing only the traffic your rules permit.
That definition comes from NIST Special Publication 800-41 Rev. 1, the US government's firewall guidance, published in September 2009. CISA puts it more plainly for home and small-office users: firewalls shield your computer or network from malicious or unnecessary traffic, and can block data from certain addresses, applications or ports while letting legitimate traffic through.
In practice, a firewall sits at the boundary between a trusted network — your office, your home Wi-Fi, your servers — and an untrusted one, usually the internet. It checks every connection against a rulebook and either lets it through or drops it.
How does a firewall work?
A firewall compares each packet or connection against its rules, using source and destination IP addresses, port numbers and protocols, then allows or blocks it.
At the most basic level, it reads the header on every packet: where it came from, where it is going, which port it targets, and whether it uses TCP, UDP or ICMP. A rule might say "allow web traffic to our server on port 443" or "block all incoming connections from this address range".
More advanced firewalls go further. Stateful firewalls track active connections, so they recognise an incoming packet as a reply to a request your device made moments earlier, rather than an unsolicited attempt. Application-aware and next-generation firewalls inspect the actual content of traffic to identify the application and whether it contains known attack patterns.
What are the main types of firewall?
The main types are packet-filtering, stateful inspection, proxy and application-level, next-generation, web application, and host-based firewalls — each inspecting traffic at a different depth.
| Type | What it checks | Strengths | Weaknesses |
|---|---|---|---|
| Packet filtering | Addresses, ports, protocol | Fast, simple, cheap | No memory, cannot see content |
| Stateful inspection | Packets plus connection state | Recognises legitimate replies | Cannot inspect application content |
| Proxy / application gateway | Full application content | Most secure traditional type | Slower, needs a proxy per app |
| Next-generation (NGFW) | App, user, content, threats | Deep inspection, intrusion prevention | Costly, needs tuning and updates |
| Web application (WAF) | HTTP attacks on web apps | Blocks SQL injection, XSS | Protects web apps only |
| Host-based | Traffic on one device | Travels with the laptop, per-app control | Protects only that device |
Most modern products combine several of these. A home router usually has packet filtering and stateful inspection. A business next-generation firewall adds application awareness, intrusion prevention and TLS inspection in one box.
What is a next-generation firewall (NGFW)?
A next-generation firewall reads traffic at the application layer as well as the network layer, with deep packet inspection, TLS decryption and intrusion prevention.
That definition comes from NIST SP 800-215, published in November 2022. The key difference from a traditional firewall is application awareness: an NGFW knows the traffic is a file-sharing app or a video call, not just traffic on port 443, and can block the app even when it hides on a common port.
NGFWs are the standard choice for businesses that need to control which applications staff can use, inspect encrypted traffic, and stop known exploits at the network edge. They cost more and need more tuning than a basic firewall, and TLS inspection raises privacy questions — tell staff what is inspected and why.
What is a web application firewall (WAF)?
A web application firewall sits in front of web servers and inspects HTTP traffic for attacks such as SQL injection and cross-site scripting.
NIST notes that a WAF is often considered very different from a traditional firewall, because it understands web applications rather than general network traffic. It does not replace a network firewall: it protects the website, while the network firewall protects the network around it. Many businesses run both, and cloud WAFs are available as a service if you do not want to run one yourself.
Network firewall vs host-based firewall: which do you need?
You need both. A network firewall protects everything behind it; a host-based firewall protects one device wherever it goes.
CISA makes this point directly for home and small offices: a network firewall is a physical device between your computer and the internet, often built into a router, and is useful for protecting several computers at once. A software firewall runs on the computer itself, can control individual applications, and is included in most operating systems.
CISA adds that the decision to use a firewall is more important than deciding which type you use — and that you should enable the operating system firewall even if you already have a network firewall. A laptop on hotel Wi-Fi has no network firewall protecting it, so its host firewall is the only barrier.
What is the default-deny rule?
Default deny means all inbound and outbound traffic not expressly permitted by the firewall policy is blocked, and you open only what you actually use.
NIST states this as the core firewall policy rule, and it is the single most important habit in firewall security. Start closed, then add narrow rules: a specific source, a specific destination, a specific port — never "any to any". Every open port is a door; default deny means you only open the doors you need, and you know why each one is open.
Rule order matters too. Firewalls usually apply the first matching rule, so put specific allow rules before broad ones, and review the list regularly. Unused rules, temporary test rules and overly broad rules are how breaches happen — a rule opened for one project in 2023 is still open in 2026 unless someone removes it.
How do you set up a firewall?
Turn on the firewall you already have, update it, change default passwords, set default deny, and review the rules on a schedule.
- Turn on what you have. Enable the firewall in Windows, macOS or Linux, and check your router's firewall is on.
- Update firmware and change defaults. Install updates before the firewall goes live, and replace the default admin password.
- Turn off remote management, UPnP and WPS unless you have a specific need for them.
- Set default deny for incoming traffic and allow only the services you need.
- Remove old port-forwarding rules. Each one exposes a device inside your network.
- Turn on logging and send logs somewhere you will actually review them.
- Test the rules, back up the configuration and review it every few months.
For a business, add segmentation: put staff, guests, phones and cameras on separate networks with rules between them, and put public-facing servers in a screened subnet (DMZ) between two firewalls. If a web server is hacked, the attacker still faces a second firewall before reaching anything internal. Our guide to how to secure your Wi-Fi covers guest networks and router settings in the same spirit.
What can a firewall not protect against?
A firewall cannot stop attacks that start inside the network, malware carried in allowed traffic, or connections that bypass it entirely.
An insider is already inside. Malware over HTTPS looks like allowed web traffic unless the firewall inspects it. A rogue Wi-Fi network, a personal hotspot or an unauthorised VPN goes around the firewall completely. And no firewall protects against its own misconfiguration — a wrong rule can open the very door you meant to close.
That is why a firewall is one layer, not a complete defence. Pair it with updates, endpoint protection, phishing-resistant MFA and staff training. The FCC's small-business guidance says it directly: provide firewall security for your internet connection, and make sure the operating system firewall is enabled too — as part of a wider set of controls, not on its own.
What are the most common firewall mistakes?
The most common mistakes are leaving default passwords, opening ports with "any to any" rules, never reviewing rules, and never looking at the logs.
- Default passwords: change them on day one, on the router and on the firewall appliance.
- Overly broad rules: allow a specific source and port, not the whole internet.
- Forgotten rules: review the rule list quarterly and remove anything unused.
- No logging: a firewall that blocks silently teaches you nothing about who is probing you.
- End-of-life hardware: replace routers and firewalls that no longer get security updates — in 2025 the FBI warned criminals were taking over end-of-life routers and renting them out as proxies.
- No backup: back up the configuration before every change, so a bad rule can be undone in minutes.
NIST defines firewalls and their policy in SP 800-41 Rev. 1, Guidelines on Firewalls and Firewall Policy.
CISA explains the home and small-office choice in its telework and home network guidance.
Firewalls also protect the email that reaches your team — see what DKIM is.
The bottom line
A network security firewall is a simple idea done well: check every connection, allow only what you approved, and log the rest. Default deny, narrow rules and regular reviews matter more than which brand you buy.
Start today by enabling the firewall on your devices and router, and checking what is exposed to the internet. You can check your website's public security posture with our free security headers checker.
Frequently asked questions
What is a network security firewall?
A network security firewall is a device or program that controls the flow of network traffic between networks or hosts with different security postures. It sits at the boundary between a trusted network and the internet and allows or blocks each connection against a set of rules.
What is network firewall security?
Network firewall security is the practice of using firewalls, rules, segmentation and logging to control which systems can talk to each other and to the internet. It includes the firewall itself, its policy, regular rule reviews and monitoring of blocked traffic.
How does a firewall work?
A firewall compares each packet or connection against its rules, using source and destination addresses, ports and protocols. Stateful firewalls also track whether a packet belongs to a session you started. Next-generation firewalls add application, user and content inspection.
What is the difference between a firewall and antivirus?
A firewall controls network traffic: it allows or blocks connections between networks or devices. Antivirus looks for malicious code on a device and stops or removes it. You need both, because they protect different things.
Do I need a firewall at home?
Yes, and you probably already have two: one in your router and one in your computer's operating system. CISA says the decision to use a firewall matters more than which type you use, and most operating systems include one you should enable.
What is a next-generation firewall?
A next-generation firewall is a firewall that inspects traffic at the application layer as well as the network layer. NIST SP 800-215 defines it by application awareness, deep packet inspection, TLS decryption with payload inspection, and intrusion prevention.
What is the difference between a firewall and a WAF?
A firewall controls general network traffic between networks. A web application firewall sits in front of web servers and inspects HTTP traffic for attacks such as SQL injection and cross-site scripting. A WAF protects web apps; a firewall protects the network.
Can a firewall be hacked?
Yes. Firewalls face the internet and often carry VPN access, and firewall flaws have been added to CISA's Known Exploited Vulnerabilities catalog in 2024, 2025 and 2026. Keep firewall firmware updated, restrict admin access, and monitor its logs.
Sources
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.
Checked against NIST SP 800-41 Rev. 1 and SP 800-215, CISA firewall guidance for home and small offices, and NCSC network guidance.
How we write and fact-check →