A network firewall is a device or software that controls traffic flowing between networks with different levels of trust, such as your office network and the internet. It checks each connection against a set of rules based on addresses, ports, protocols and applications, then allows the traffic that matches an approved rule and blocks the rest.
Key takeaways
- A network firewall enforces a deny-by-default policy: only traffic an explicit rule allows gets through.
- Modern firewalls range from simple packet filters to next-generation firewalls that inspect applications and users.
- A firewall is one layer of defense: it cannot stop malware you download, insider misuse or attacks inside allowed traffic.
Every device on your network is reachable from the internet unless something stands in the way. A network firewall is that something: a control point that decides, connection by connection, what is allowed in and out.
What is a network firewall?
A network 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 your office network and the internet, or between two internal network segments — and enforces your security policy on every connection that crosses it.
The formal definition comes from NIST Special Publication 800-41 Rev. 1, Guidelines on Firewalls and Firewall Policy, which describes firewalls as devices or programs that control traffic between networks employing differing security postures. CISA puts it more plainly for home and small-office users: firewalls shield your computer or network from malicious or unnecessary network traffic, and can also stop malicious software from reaching a computer over the internet.
In practice, a firewall does three things. It inspects traffic, compares it with a set of rules, and then allows, blocks or logs it. The rules describe traffic by source and destination address, port, protocol and, on more advanced firewalls, by application and user.
Most small businesses already have at least two firewalls without realizing it: one built into the internet router and one built into every computer's operating system. The question is rarely whether to have a firewall, but whether yours is switched on, updated and configured on purpose rather than left on factory defaults.
How does a network firewall work?
A network firewall works by evaluating each connection against an ordered list of rules and applying the first rule that matches. Each rule names the traffic — who can talk to what, on which port and protocol — and an action: allow or deny.
When a packet arrives, the firewall looks at its headers: source and destination IP addresses, source and destination ports, and the protocol, such as TCP or UDP. A basic packet-filtering firewall stops there. A stateful firewall goes further and tracks the connection in a state table, so it can recognize that an incoming packet is a legitimate reply to a request your device made a moment earlier, rather than an unsolicited connection attempt from outside.
More advanced firewalls inspect deeper. An application-level firewall or proxy opens its own connection to the destination and examines the application traffic itself, catching unexpected commands or malformed requests. A next-generation firewall adds application identity, user identity and intrusion prevention, so a rule can say "allow the finance team to use the accounting app" instead of only "allow port 443".
Rules are usually evaluated top to bottom, and the first match wins. That makes rule order a security decision in itself: a broad allow rule placed above a specific deny rule will quietly override it. This is why NIST advises keeping rulesets as specific as possible and reviewing them regularly.
The default matters most of all. NIST recommends deny by default: all inbound and outbound traffic not expressly permitted by the firewall policy should be blocked. Start from nothing allowed, then add narrow allow rules only for traffic with a documented business need.
What are the main types of network firewalls?
The main types are packet-filtering, stateful inspection, application-level proxy, circuit-level gateway, next-generation and web application firewalls. Most modern products combine several of these, but the distinctions still decide what a rule can express.
| Type | What it inspects | Strengths | Limitations |
|---|---|---|---|
| Packet-filtering | Packet headers: IP, port, protocol | Fast, simple, low overhead | No connection state, blind to content |
| Stateful inspection | Headers plus connection state | Blocks unsolicited replies | Still blind to application content |
| Application proxy | Full application traffic | Deepest inspection, hides internal hosts | Slower, needs a proxy per application |
| Circuit-level gateway | Session handshake (layer 5) | Verifies sessions before relaying | Does not inspect packet content |
| Next-generation (NGFW) | Layers 3–7, app and user identity | App-aware rules, intrusion prevention | Costly, needs tuning and updates |
| Web application (WAF) | HTTP traffic to a web app | Blocks injection and cross-site scripting | Protects web apps only |
| Host-based | Traffic on one device | Travels with the laptop, per-app control | Protects one device only |
Packet-filtering firewalls are the oldest type. They check each packet in isolation against rules for addresses, ports and protocols. They are fast and cheap, but they cannot tell whether a packet belongs to a legitimate session, and they cannot see inside the traffic at all.
Stateful inspection firewalls fix that weakness by keeping a table of active connections. When a device inside the network opens a connection outward, the firewall records it and only lets matching replies back in. Stateful inspection is now standard in home routers, business gateways and cloud security groups.
Application-level gateways (proxies) end the connection at the firewall and open a new one to the destination, inspecting the actual application data in between. They are the most thorough traditional type, but they are slower and need a proxy for each application protocol.
Next-generation firewalls layer application awareness, user identity, intrusion prevention and often TLS inspection on top of stateful inspection. They can identify applications even when they run over standard web ports, which matters because most modern traffic, good and bad, travels over port 443.
Web application firewalls are a specialist type that protects a specific website or web app from attacks such as SQL injection and cross-site scripting. A WAF is not a substitute for a network firewall: it guards one application, not the network. You can check how a site's own headers hold up with our free security headers checker.
Network firewall vs host-based firewall: what's the difference?
A network firewall protects a whole network at its boundary, while a host-based firewall protects a single device. The difference is placement: one guards the perimeter, the other guards the machine.
A network firewall is usually a dedicated appliance or a feature of the router or gateway. It protects every device behind it at once — computers, printers, cameras, point-of-sale terminals — including devices that cannot run security software themselves. Its weakness is that it only sees traffic that crosses it. A laptop working from a coffee shop is outside its protection entirely.
A host-based firewall is software running on the device itself, such as Windows Defender Firewall or the firewall built into macOS. It controls network access per application on that machine, and it travels with the device wherever it goes. CISA recommends keeping the built-in firewall enabled even when a network firewall is also present upstream.
Use both. The network firewall is the perimeter gate; the host firewall is the lock on each door inside. If one fails or is bypassed, the other still limits what an attacker can reach.
What is a next-generation firewall (NGFW)?
A next-generation firewall is a firewall that understands applications and users, not just addresses and ports. It combines stateful inspection with deep packet inspection, intrusion prevention, application control and user identity, and often includes TLS inspection and threat intelligence feeds.
The practical difference shows up in the rules you can write. A traditional firewall rule says "allow TCP 443 to the internet". An NGFW rule can say "allow the sales team to use the CRM app, block file-sharing apps, and inspect the traffic for malware". Because attackers hide in ordinary web traffic, that application awareness is what makes an NGFW worth its price for a business with a web presence or remote workers.
NGFWs are not free of trade-offs. They cost more than a basic router firewall, they need regular signature and threat-intelligence updates, and TLS inspection raises privacy and legal questions that should be decided with a written policy.
For a very small office with no servers and no remote access, a stateful router firewall plus host firewalls may be enough. For a business that handles card payments or sensitive data, an NGFW is the expected standard — payment-card rules require that all allowed services, protocols and ports are identified, approved and backed by a defined business need.
What is a DMZ, and where does the firewall sit?
A DMZ, or screened subnet, is a separate network segment for internet-facing servers, placed between an external firewall and an internal firewall. Public servers such as a website or mail server live in the DMZ, so a compromise of one does not give an attacker direct access to the internal network.
The layout is simple: internet traffic first hits the outer firewall, which allows only the traffic the public servers need. The DMZ servers sit behind it. A second, inner firewall separates the DMZ from the internal network and allows only the specific connections the servers need to do their job, such as a web server reaching a database on one port.
Small businesses rarely need a full two-firewall DMZ. The idea still matters, though: separate what the internet can touch from what it cannot. A guest Wi-Fi network isolated from the office network is a DMZ in miniature, and cloud security groups do the same job for cloud workloads.
How do you configure a network firewall?
Configure a network firewall by writing a short policy first, then building narrow allow rules from it, protecting the firewall itself, and testing before you rely on it. The device is only as secure as its configuration.
- Write the policy. List what the network must do: which services are public, who works remotely, which cloud apps the business uses. NIST frames the firewall policy as rules for inbound and outbound traffic by address, protocol, application and content, based on the security policy and a risk analysis.
- Start deny by default. Block everything, then add allow rules one at a time. Each rule should name a specific source, destination, port and protocol, with a business reason and an owner.
- Protect the management interface. Change default credentials, restrict admin access to a management network or VPN, and turn off remote admin from the internet. A firewall whose admin panel is exposed is worse than no firewall at all.
- Segment the network. Put guests, servers and office devices in separate zones with rules between them, so a breach in one zone cannot reach the others.
- Control outbound traffic too. Allow servers out only to the destinations they need, such as update services and partner systems. Outbound filtering limits what malware can do if it gets in.
- Turn on logging and alerts. Log denied connections and review them. A deny rule that logs is far more useful than one that silently drops traffic, because it shows you what is being probed.
- Test and review on a schedule. Test the rules after every change, and review the whole ruleset at least every few months. Remove rules nobody can explain, and give temporary rules an expiry date.
Common mistakes are easy to list and easy to make: an any-to-any allow rule left over from setup, a port opened for a one-off test and never closed, remote desktop exposed to the whole internet, and a firewall whose firmware has not been updated in years. Each one quietly cancels the protection the firewall is supposed to provide.
What can't a network firewall protect against?
A network firewall cannot protect against attacks that start inside the network, attacks carried inside allowed traffic, or connections that bypass it. Knowing these limits is as important as knowing what it does.
- Insiders and compromised devices. A firewall guards the boundary. An employee who plugs in an infected USB drive, or a laptop that was compromised off-site, is already inside.
- Malware in allowed traffic. Most web traffic is encrypted and allowed through port 443. Without TLS inspection, a firewall cannot see malware hiding in a permitted HTTPS connection.
- Social engineering. A firewall cannot stop someone from clicking a phishing link or handing a password to a fake login page. That is a people and identity problem, and our spear phishing guide covers how those attacks work.
- Bypass routes. Rogue Wi-Fi, personal hotspots and unauthorized VPNs go around the firewall entirely. Policy and endpoint controls have to close those gaps.
- Its own misconfiguration. A firewall with an any-to-any rule, exposed admin access or years-old firmware protects nothing. Regular review is part of the control, not an optional extra.
This is why security guidance always describes the firewall as one layer. It belongs alongside endpoint protection, patching, strong authentication and staff training. For a broader starting point, our small business cybersecurity checklist covers those layers together.
How do you choose the right network firewall?
Choose by the traffic you need to control, who will manage it, and what it must prove. A home user needs a router firewall and a host firewall. A small office needs a business gateway with stateful inspection, logging and guest-network segmentation. A larger business, or one handling card payments or health data, usually needs an NGFW with intrusion prevention and centralized management.
Ask these questions before buying: can it filter by application and user, not just port? Does it log denied traffic and send alerts? Can it be updated automatically, and for how long will the vendor support it? Does it handle the speed of your internet connection with inspection turned on, not just with inspection off? And who will review the rules every quarter?
Cloud-only businesses still need firewall thinking. The perimeter moves to cloud security groups, web application firewalls and the laptops themselves, but the same deny-by-default rule applies. You can check what the internet currently sees of your own connection with our free what-is-my-ip tool.
The bottom line
A network firewall is the gatekeeper that decides what crosses your network's boundary. Used well — deny by default, narrow rules, segmented zones, logging and regular review — it blocks most opportunistic attacks before they ever reach a device.
It is not a complete security strategy on its own. Pair it with endpoint protection, phishing-resistant authentication and staff training, and check your setup against the security headers checker and the rest of our free tools to see where your exposure actually sits.
Frequently asked questions
What is a network firewall in simple terms?
A network firewall is a gatekeeper for your network. It sits between your computers and the internet, checks every connection against a list of rules, and lets through only the traffic you have approved. Everything else is blocked.
What is the difference between a network firewall and a host firewall?
A network firewall protects a whole network at its boundary, such as a router or gateway device. A host firewall runs on one device, such as a laptop, and controls that device's traffic. Most setups use both: the network firewall guards the perimeter and the host firewall protects the device when it leaves the office.
Do I need a network firewall at home?
Yes, and you almost certainly already have one. Most home routers include a built-in firewall, and your operating system has a software firewall too. CISA recommends keeping both enabled and updated, and reviewing the router's default settings rather than assuming they are secure.
What is a next-generation firewall?
A next-generation firewall, or NGFW, combines stateful inspection with application awareness, user identity, intrusion prevention and often TLS inspection. It can tell which application a connection belongs to, not just which port it uses, so it can block risky apps even when they run over port 443.
Can a firewall block a website?
Yes. A firewall can block traffic to specific addresses, domains or applications, and many business firewalls filter by website category. Blocking at the firewall is a network-level control, so it applies to every device behind it, including devices you cannot install software on.
Does a firewall protect against viruses?
Only partly. A firewall blocks unwanted network connections, which stops many attacks from reaching your devices. It does not scan files you download, email attachments you open, or malware already on a device. You still need antivirus or endpoint protection alongside it.
What is the difference between a firewall and a VPN?
A firewall filters traffic at a network boundary, while a VPN encrypts traffic between two points so it cannot be read in transit. They solve different problems and are usually used together: the VPN secures the connection, and the firewall decides what the connected user or device is allowed to reach.
What does deny by default mean for a firewall?
Deny by default means the firewall blocks all traffic unless a rule expressly permits it. NIST recommends this approach in SP 800-41 Rev. 1 because it is safer than allowing everything except a blocklist: any new service, port or protocol stays closed until someone documents a business need for it.
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, the NIST CSRC Glossary and CISA guidance on firewalls for home and small office use.
How we write and fact-check →