Firewall configuration: the short answer
Good firewall configuration starts from one rule: block everything, then allow only what the business needs. On top of that, keep the firewall updated, protect its admin login, and remove old rules. Then check the logs and test the setup.
A firewall is a device or software that decides which network traffic is allowed in and out. It only protects you if its rules are right. A firewall with an "allow any" rule is like a locked door with the key taped to it. NIST, the US standards body, recommends this "deny by default" approach in its firewall guide (SP 800-41).
Firewall types in plain words
You will hear a few terms when you buy or review a firewall. Here is what they mean.
- Stateful firewall: remembers each connection. If someone in your office opens a website, the firewall lets the reply back in. Unrequested traffic from outside is blocked. Almost every business firewall works this way.
- Next-generation firewall (NGFW): a stateful firewall that also knows which app is in use, such as Teams or Dropbox, not just which port. Many include intrusion prevention (blocking known attack traffic) and web filtering.
- Web application firewall (WAF): protects a website or web app. It reads web requests and blocks common attacks, such as attempts to trick the site database. It sits in front of the site, often as a cloud service.
A port, in this guide, is a numbered door on a computer that a particular service listens on. For example, websites use port 443.
The firewall configuration checklist
Work through these 12 steps. Most take minutes once you have admin access. Write down what you change and why.
- Default deny. The last rule in each direction should block anything not allowed above it.
- Least privilege rules. Each rule should name a specific source, destination and port. Avoid "any to any" rules. If a supplier needs access, allow only their address.
- Close unused ports. If nothing should be reachable from the internet, nothing should be open. Review every inbound rule and ask who uses it.
- Keep admin interfaces off the internet. The firewall login page should only be reachable from inside the network or over a VPN. CISA, the US cyber defense agency, ordered federal agencies to do exactly this in Binding Operational Directive 23-02.
- Change default passwords. Replace the factory admin password with a long, unique one. Turn on MFA (a second login step, such as a code on your phone) if the firewall supports it.
- Update firmware. Firmware is the software that runs the device. Attackers often target known flaws in firewalls and VPN devices, so install vendor security updates promptly.
- Segment the network. Put guest Wi-Fi, cameras and smart devices on separate networks with no route to work systems. Keep payment systems apart too.
- Filter outbound traffic. Do not allow every device to talk to anywhere. Limiting outbound traffic makes it harder for malware to call home or send data out.
- Turn on logging and review it. Send logs to a central place and keep them. Someone should look at blocked and allowed traffic regularly, not only after an incident.
- Remove old rules. Review the rule list at least once a year. Delete rules for old projects, former suppliers and retired servers. Give each rule an owner and a note.
- Test every change. Back up the configuration first. After a change, check that the business still works and that blocked services are really blocked.
- Secure remote access. Use a VPN (an encrypted tunnel into your network) or a zero trust access service with MFA. Never open remote desktop straight to the internet.
Firewall rules: risky services to keep off the internet
Some services should almost never be open to the whole internet. Attackers scan for them all day. If your firewall rules allow any of these from outside, close them or put them behind a VPN.
| Service | Usual port | Why it is risky when exposed |
|---|---|---|
| Remote Desktop (RDP) | TCP 3389 | A common way in for ransomware gangs through guessed or stolen passwords |
| Windows file sharing (SMB) | TCP 445 | Used by the WannaCry worm in 2017; built for internal networks only |
| Telnet | TCP 23 | Sends passwords in plain text that anyone in the path can read |
| FTP | TCP 21 | Also sends passwords in plain text; use SFTP instead |
| Database servers (SQL Server, MySQL) | TCP 1433, 3306 | Databases should only talk to your own apps, not the internet |
| VNC remote control | TCP 5900 | Often set up with weak or no passwords |
Firewall best practices for keeping it right over time
A firewall that is set up well today drifts over time. Staff add "temporary" rules that stay forever. Suppliers come and go. These habits keep it clean:
- Use a simple change request, even an email, for every new rule. Record who asked, why, and when it can be removed.
- Review the full rule list once a year, and after any big change such as an office move.
- Keep a copy of the configuration somewhere safe, so you can rebuild after a failure.
- Make one named person responsible, whether in-house or at your IT provider.
Firewalls also do not stop every attack. Someone on public Wi-Fi can still be caught by a man-in-the-middle attack, and a phishing email can still reach a laptop. A firewall is one layer, not the whole plan.
How to check your firewall is really working
You cannot be sure a firewall is right just by reading its rules. Test it from the outside, the way an attacker would.
A vulnerability scan checks which ports are open and flags known weak spots. A penetration test goes further: a tester tries to get through, using what the scan finds. Our guide to vulnerability assessment vs penetration testing explains which one fits your stage. Many businesses run a scan every quarter and a test once a year.
How NextGarrison helps
Our penetration testing includes an external network test. We check which services your firewall exposes, try to get past it and review risky rules. You get a clear list of fixes in priority order, written so your IT provider can act on it.
Sources

Need a hand with this?
Talk to a senior consultant. We reply within one business day with clear next steps and a scoped quote.
Prefer to just ask? Contact us and a consultant will reply.
Written by
Vince AntonioSecurity writer and consultant, NextGarrison
Vince writes NextGarrison's security news, technical vulnerability write-ups and guides. He covers actively exploited flaws, penetration testing, SOC monitoring and getting ready for SOC 2, ISO 27001 and PCI DSS, in plain English with sources for every claim.
Want the next alert like this one?
New vulnerability alerts as soon as we publish them. Free, no sign-up, works in Feedly, Outlook, Slack and Teams.
