Updated September 2026. We rewrote this guide with current steps for Windows, macOS, Linux and home routers, plus a six-step process for business firewalls based on NIST SP 800-41, CIS Controls v8.1 and recent CISA guidance. Outdated vendor quotes and a 2019 Gartner prediction were removed.
A firewall decides which network traffic is allowed in and out, based on rules you set. Setting one up well comes down to three ideas: block everything you don’t need, protect the firewall itself, and keep the rules and firmware up to date. This guide starts with the quick setup most people need, then walks through a full configuration for an office or business network.
Firewalls also need protecting themselves. Verizon’s 2026 Data Breach Investigations Report found that exploited vulnerabilities were the most common way attackers got in, at 31% of breaches, and VPNs, firewalls and other edge devices were frequent targets (Verizon DBIR). A badly configured or unpatched firewall can become the way in.
Get the 5-Minute Weekday Cyber Brief
The cyber stories worth paying attention to, filtered from 100+ trusted sources and explained fast.
By subscribing you agree to our Privacy Policy.
Free. Weekday mornings. 5 minutes or less.
Quick answer: how to set up a firewall
- Turn on the firewall that’s already there. Windows, macOS and most Linux distributions include one, and every home router has a basic one.
- Update firmware and change default passwords before the firewall goes live.
- Set a default-deny rule for incoming traffic and allow only the services you need.
- Close remote admin access from the internet, or restrict it to a VPN and specific IP addresses.
- Turn on logging so you can see what gets blocked and spot problems.
- Test the rules, back up the configuration and review it on a schedule.
Set up the firewall on your computer
Host-based firewalls protect a device even on hotel, airport or coffee-shop Wi-Fi. CIS Controls v8.1 lists them as basic safeguards for both servers (4.4) and end-user devices (4.5), with a default-deny approach (CIS).
Windows 11
- Open Start, search for Windows Security and select Firewall & network protection.
- Check that the firewall is On for Domain, Private and Public networks.
- Mark untrusted networks (like public Wi-Fi) as Public. Windows applies stricter rules to that profile.
- Use Allow an app through firewall only for apps you trust and recognize. Remove old entries you no longer use.
Microsoft’s Windows Security firewall guide explains each setting. Businesses usually manage these rules centrally with Intune or Group Policy instead of on each PC.
macOS
- Choose Apple menu > System Settings > Network > Firewall and turn it on.
- Click Options. Turn on stealth mode so your Mac doesn’t answer probes such as ping.
- For maximum protection on untrusted networks, choose Block all incoming connections. Turn it off again if you need file or screen sharing.
See Apple’s guide to blocking connections with the macOS firewall.
Linux (Ubuntu and Debian with UFW)
UFW (“uncomplicated firewall”) is a simple front end for the Linux packet filter. On a server you reach over SSH, allow SSH before you enable the firewall so you don’t lock yourself out:
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status verbose
Add rules only for services the machine actually offers, such as sudo ufw allow 443/tcp for a web server. Ubuntu’s firewall documentation covers more options.
Set up the firewall on your home router
Your router’s built-in firewall blocks unsolicited traffic from the internet by default. Most of the work is closing the extra doors manufacturers leave open. The NSA’s home network guidance recommends the same basics:
- Log in to the router’s admin page or app, update the firmware and turn on automatic updates if available.
- Replace the default admin password with a long, unique one.
- Turn off remote management (admin access from the internet), UPnP and WPS unless you have a specific need.
- Remove old port-forwarding rules. Each one exposes a device inside your network.
- Put smart-home devices and visitors on a guest network so they’re separated from your computers.
- Replace routers that no longer get security updates. In 2025 the FBI warned that criminals were taking over end-of-life routers and renting them out as proxies for cybercrime (FBI IC3).
For Wi-Fi settings such as WPA3, see our guide to wireless network security.
How to configure a business firewall in 6 steps
These steps apply to any network firewall, whether it’s a hardware appliance, a virtual firewall or a cloud firewall. They follow the lifecycle in NIST SP 800-41, the U.S. government’s firewall guidance (NIST). If you’re still choosing a device, our comparison of hardware vs. software firewalls explains the trade-offs.
Step 1: Secure the firewall itself
- Install the latest firmware before connecting it to production, and subscribe to the vendor’s security advisories.
- Delete or disable default accounts and replace default passwords.
- Give each administrator a named account with only the permissions they need, and require multi-factor authentication for admin logins.
- Allow management only from an internal management network or VPN, never from the open internet. CISA’s Binding Operational Directive 23-02 requires federal agencies to remove internet-exposed management interfaces for this reason (CISA).
- Turn off unencrypted management protocols such as Telnet and plain HTTP. Use SSH and HTTPS.
Step 2: Plan zones and IP addressing
Group systems into zones based on how sensitive they are and who needs to reach them. A typical layout:
- Internet-facing (DMZ): public web servers, mail gateways and similar systems.
- Internal servers: databases, file servers and business applications. Databases shouldn’t be reachable directly from the internet.
- User networks: employee laptops and desktops.
- Guest and IoT: visitors, cameras, printers and other devices that are hard to secure.
- Management: the network your admins use to manage infrastructure.
Assign each zone its own subnet and VLAN, then map zones to firewall interfaces. More zones mean better separation but more rules to maintain, so start simple.
Step 3: Write access rules (ACLs) with default deny
- End every rule set with an explicit deny all rule, and log what it blocks.
- Make each allow rule as narrow as possible: specific source, destination and port. Avoid “any-any” rules.
- Filter outbound traffic too. Limiting which systems can reach the internet, and on which ports, makes it harder for malware to call home or send data out.
- Add a short comment to every rule saying who asked for it, why and when it should be reviewed.
Step 4: Turn on security features and logging
Most current firewalls are “next-generation” firewalls that can do more than filter ports: application control, intrusion prevention (IPS), web filtering and TLS inspection. Turn on what you’ll actually monitor, and disable services you don’t need, such as a DHCP server when another device already does that job. Send logs to a central log server or SIEM and sync the clock with NTP so timestamps line up during an investigation. If you handle card data, PCI DSS 4.0.1 has specific rules for network security controls and logging.
Know what matters before your first meeting.
Weekday mornings. Five minutes. What changed in security, why it matters.
By subscribing you agree to our Privacy Policy.
Free. Weekday mornings. 5 minutes or less.
Step 5: Test before and after going live
- Scan from outside your network to confirm only the expected ports are open. Nmap is the standard free tool; see our list of cybersecurity tools for others.
- Test from each internal zone to confirm traffic between zones is blocked where it should be.
- Include the firewall in penetration tests and vulnerability scans.
- Back up the working configuration to a secure location so you can restore it quickly after a failure.
Step 6: Manage it in production
- Patch quickly. Firewalls and VPN gateways are prime targets. In September 2025 CISA issued Emergency Directive 25-03 ordering federal agencies to find and fix compromised Cisco ASA and Firepower devices after attackers exploited zero-day flaws (CISA). Check CISA’s Known Exploited Vulnerabilities catalog for your firewall model.
- Review rules on a schedule, at least every six months. Remove unused, duplicate and overly broad rules.
- Use change control: every change should be requested, approved, documented and reversible.
- Watch the logs for repeated blocked connections, unexpected outbound traffic and admin logins.
- Replace end-of-life hardware before vendor support ends.
Common firewall setup mistakes
| Mistake | Why it’s risky | Fix |
|---|---|---|
| “Allow any” rules left from setup | They quietly open the network | Replace with specific rules, then delete the broad ones |
| Admin interface reachable from the internet | Attackers scan for and exploit these constantly | Restrict management to a VPN or internal network |
| Ignoring outbound traffic | Malware and data theft go out unnoticed | Allow only needed outbound services |
| Delayed firmware updates | Known flaws are exploited within days | Track vendor advisories and patch urgently |
| No logging or no one reviewing logs | Attacks go unnoticed | Centralize logs and set alerts |
| Shared admin accounts | No accountability, easy to abuse | Named accounts with MFA |
For more settings to check, see our guide to the best firewall settings. A firewall is one control among many; our cybersecurity controls and cybersecurity checklist guides show where it fits. To keep up with new firewall and VPN vulnerabilities as they’re disclosed, sign up for the CyberExperts Daily Brief, a short weekday email.
Frequently asked questions
How do I set up a firewall at home?
Turn on the firewall built into your computer (Windows Security or macOS System Settings), then log in to your router, update its firmware, change the admin password and turn off remote management, UPnP and WPS. For most homes, that plus automatic updates is enough.
Do I need a firewall if my router has one?
Yes, keep both on. The router firewall blocks unsolicited traffic from the internet, while the firewall on your computer protects it on other networks, like public Wi-Fi, and from other devices on your own network.
What is the most important firewall rule?
Default deny: block all incoming traffic unless a rule specifically allows it. Add narrow allow rules only for services you need, and log what the deny rule blocks.
How often should firewall rules be reviewed?
At least every six months, and whenever systems are added or retired. Remove unused, duplicate and overly broad rules. Firmware should be updated as soon as security patches are released.
Should I block outbound traffic?
On business networks, yes, at least partly. Limiting which systems can reach the internet and on which ports makes it harder for malware to communicate or send data out. On a home computer, the default of allowing outbound traffic is usually fine.
Is Windows Firewall good enough?
For most home users, yes, as long as it stays on and you only allow apps you trust. Businesses usually manage it centrally and add a network firewall at the edge.
How do I test my firewall?
Scan your public IP address from outside your network with a tool like Nmap to see which ports are open. Only the services you intended to expose should respond. Businesses should also test between internal zones and include the firewall in penetration tests.
Sources
- NIST SP 800-41 Rev. 1, Guidelines on Firewalls and Firewall Policy: csrc.nist.gov
- CIS Critical Security Controls v8.1 (Safeguards 4.4 and 4.5): cisecurity.org
- Verizon, 2026 Data Breach Investigations Report: verizon.com
- CISA, Binding Operational Directive 23-02: Mitigating the Risk from Internet-Exposed Management Interfaces: cisa.gov
- CISA, Emergency Directive 25-03: Identify and Mitigate Potential Compromise of Cisco Devices: cisa.gov
- CISA, Known Exploited Vulnerabilities Catalog: cisa.gov
- NSA, Best Practices for Securing Your Home Network (2023): media.defense.gov
- FBI IC3, Cyber Criminal Proxy Services Exploiting End of Life Routers (May 2025): ic3.gov
- Microsoft, Firewall and network protection in the Windows Security app: support.microsoft.com
- Apple, Block connections to your Mac with a firewall: support.apple.com
- Ubuntu Server documentation, Firewalls: documentation.ubuntu.com
Newer CyberExperts coverage on this topic
This article still works as background. If you want the current picture, start with the freshest related coverage below and today's brief.
Boost Your Software Quality Today With These Essential Regression Testing Tools
Are you a software developer or in quality assurance? If so, you're aware of the significance of regression testing in eliminating errors...
OpenSea NFT Vulnerabilty Discovered
A vulnerability was found in the OpenSea NFT marketplace that allowed attackers to create fake listings and deceive buyers into purchasing fake...
<strong>How to Create an Effective Data Recovery Strategy</strong>
Hackers compromise data daily, with more creative efforts testing the limits of analysts beyond modern capabilities. New strategies are needed to keep...
Tuesday’s brief: GitLab’s critical fix, then Patch Tuesday, hijacked fridge controllers and Server 2012’s last update
The fastest way to catch up on what changed after this article was published.
Start your morning with the signal that matters.
Get the biggest cybersecurity developments, why they matter, and where to go deeper on CyberExperts.
By subscribing you agree to our Privacy Policy.
Free. Weekdays. Built for operators.