The firewall as the first line of defense: what you need to know
Network security fundamentals: what a firewall is, the types (stateful, NGFW, WAF, FWaaS), best practices, and the threats it must contain.
Security starts at the perimeter
Since the late 1980s, the firewall has been the first line of defense for any network. Despite everything that has evolved since then — cloud, Zero Trust, SASE — the principle remains intact: strictly control the traffic that enters and leaves between networks with different trust levels. The NIST defines it plainly as a "device or program that controls the flow of network traffic between networks or hosts with distinct security postures" [1].
But the concept of a firewall has long stopped being just about port and IP address rules. A modern firewall inspects the content of traffic, identifies applications and users, and blocks known threats in real time.
What a firewall actually is
In simple terms, a firewall is an intelligent filter placed between a trusted network (your LAN) and an untrusted network (typically the internet). Every packet of data that tries to cross that boundary is evaluated against a set of rules: if it matches allowed traffic, it passes; otherwise, it is dropped [2].
The image of the "firebreak wall" (from the English firewall, originally the wall that contains a fire inside a building) is accurate: the goal is to contain the threat and stop it from spreading.
How it works
A firewall decides based on rules ordered by priority. Each rule combines criteria such as:
- Source and destination IP address and port
- Protocol (TCP, UDP, ICMP…)
- Traffic direction (inbound or outbound)
- Connection state (new connections vs. already established)
- Application or user identity (on next-generation firewalls)
The first rule that matches is the one that applies — which is why the order of rules is critical. And the last rule should almost always be "deny everything else" (default deny).
Types of firewalls
The technology has evolved over generations. Knowing the differences helps you choose the right solution [2][1]:
- Packet filtering (packet filter) — the first generation, 1980s. Evaluates each packet in isolation based on IP, port, and protocol. Fast, but "blind" to the context of the connection.
- Stateful inspection — remembers the state of connections (state table) and only allows response traffic for connections initiated from the inside. Smarter, with little performance cost.
- Next-generation firewall (NGFW) — combines stateful with deep packet inspection, application recognition (even on port 443), user identity, antimalware, and intrusion prevention (IPS). This is today's enterprise standard.
- Proxy / application-level gateway — intermediates connections (there is no direct connection between client and server). Slower, but filters at the application layer.
- WAF (Web Application Firewall) — protects web applications from attacks such as SQL injection, XSS, and CSRF. It acts as a reverse proxy in front of the application, not the network.
- FWaaS (Firewall as a Service) — a cloud firewall, with no hardware. Ideal for multi-cloud assets and remote workers.
Configuration best practices
Regardless of the type, there are principles that make the difference between a useful firewall and one that only gives a false sense of security. The CIS (Center for Internet Security) summarizes them in its Controls [3]:
- Default deny — block everything by default and open only what is strictly necessary (the principle of least privilege).
- Network segmentation — separate the internal LAN, the DMZ (public servers), IoT, and the guest network. A compromise in one zone should not reach another.
- Outbound rules — filtering inbound traffic is not enough. Much of the malware and data exfiltration uses outbound connections; restricting what leaves is just as important as what enters.
- Regular rule review — rules pile up over time. Review and clean them regularly (an "orphan rule" is a risk).
- Logging, alerts, and monitoring — rules without monitoring are useless. Logs should feed into a SIEM.
- Up-to-date firmware and patches — an outdated firewall is itself a vulnerability.
Threats a modern firewall must contain
- Unauthorized access to internal services exposed by mistake
- Port scanning (port scanning) and network reconnaissance
- Command-and-control (C2) traffic from ransomware and botnets
- Exploitation attempts of known vulnerabilities (blocked by the IPS)
- Data exfiltration by malware already inside the network
- Lateral movement (lateral movement) after an initial compromise
Firewalls and Zero Trust: complementary, not replacements
The Zero Trust model ("never trust, always verify") does not make the firewall obsolete. Quite the opposite: Zero Trust operates at the identity and application level, while the firewall remains essential at the network level. The two layers reinforce each other — it's the classic defense-in-depth strategy.
Conclusion
A well-configured firewall is not an expense: it is an investment in business continuity. If your organization still doesn't have a documented firewall policy — with baseline rules, segmentation, and monitoring — you are, literally, leaving the door open. Start with the essentials: default deny, segment, and monitor.
References
- [1] NIST SP 800-41 Rev.1 — Guidelines on Firewalls and Firewall Policy (2009) — csrc.nist.gov
- [2] Cloudflare — What is a Firewall? — cloudflare.com/learning
- [3] CIS Controls v8 — Center for Internet Security — cisecurity.org/controls
- [4] ENISA — European Union Agency for Cybersecurity — enisa.europa.eu
High availability: why 99.9% uptime is not enough
When 0.1% downtime means hours lost — the "nines" explained, the Google SRE error budget, and how to build truly resilient infrastructure.
Ler artigo →