What is a firewall?
A firewall is a network security device or software that monitors and filters incoming and outgoing network traffic, deciding whether to allow or block it based on a defined set of security rules. It acts as a barrier between a trusted internal network and untrusted external networks such as the internet, letting safe, legitimate traffic through while keeping unauthorized users and malicious data out. Firewalls can be delivered as hardware, software, or a cloud-based service, and they range from simple packet filters to advanced next-generation firewalls (NGFWs) that inspect traffic deeply and apply threat intelligence in real time.
Key takeaways
- A traffic gatekeeper: A firewall inspects data packets against security rules and allows, blocks, or drops them to protect a network.
- Sits between trusted and untrusted networks: Most often between a private network and the internet, though firewalls can also protect a single device or segment internal traffic.
- Many types available: Packet filtering, stateful, proxy, NGFW, web application firewall (WAF), UTM, virtual, cloud-native, and firewall-as-a-service, delivered as hardware, software, or cloud.
- Four generations of evolution: From 1989 packet filtering to today's AI-powered NGFWs with deep packet inspection and intrusion prevention.
- Necessary but not sufficient: A firewall controls access at the perimeter; it does not by itself detect and respond to threats that get through, which is where a detection-and-response layer comes in.
What does a firewall do and how does it work?
A firewall's core job is to control network traffic. It sits at a boundary, typically the network edge or a data center, and inspects every data packet trying to cross it. Using predefined rules, the firewall compares each packet against criteria such as source and destination IP address, port number, and protocol type. If the packet matches an allow rule, it passes; if it violates the rules, the firewall blocks or drops it and can log a security event. In enterprise environments, individual rules are grouped into access control lists (ACLs) and evaluated in order until a match is found.
More advanced firewalls do not judge each packet in isolation. Using stateful inspection, they track the full state and context of a connection, so they can tell whether a packet is a legitimate part of an established session or something unexpected. Deep packet inspection (DPI) goes further still, examining the actual contents of a packet, not just its header, which lets the firewall spot malware or prohibited content hidden inside otherwise normal-looking traffic. Modern firewalls also compare traffic against threat intelligence feeds of known malicious signatures, and they treat direction differently: north-south traffic entering from outside is inspected closely, while east-west traffic moving between internal systems is watched to catch attackers moving laterally once inside.
Firewall generations: a short history
Firewalls have been around since the late 1980s and have evolved through four broad generations, each answering the threats of its era:
- Packet filtering (1989): The first generation examined individual packets by header (IP, port, protocol) but could not see inside them to detect malicious code.
- Stateful inspection (1990s to early 2000s): The second generation, pioneered commercially by Check Point's FireWall-1 in 1993, tracked the state of active connections and used context to spot suspicious behavior.
- Proxy / application-level gateways (early 2000s): The third generation acted as an intermediary at Layer 7 of the Open Systems Interconnection (OSI) model, fully separating client and server and inspecting application-level traffic.
- Next-generation firewalls (around 2010 onward): The fourth generation combined traditional filtering with deep packet inspection, intrusion prevention, application awareness, and threat intelligence. Today this is extending into AI-powered and cloud-delivered firewalls.
Earlier generations are still in use today. Many networks run a mix, applying the right type of firewall to the right place.
Types of firewalls
Firewalls are commonly categorized by how they inspect traffic, but they can also be grouped by what they protect (an entire network or a single host), their form factor (hardware, software, or cloud), and where they sit in the network (perimeter, internal, distributed, or hybrid mesh). The main types by inspection method are:
Packet filtering firewall
The simplest and fastest type. It checks each packet's header against rules for source and destination IP, port, and protocol, then allows or blocks it. Cost-effective but limited, since it cannot see packet contents or connection context.
Stateless vs. stateful firewalls
A stateless firewall inspects each packet independently at the transport layer, with no memory of previous packets, so it cannot tell whether a packet belongs to an existing connection. A stateful firewall tracks the state and context of active connections, making more informed allow or block decisions. Stateful inspection offers stronger protection but uses more processing power.
Proxy firewall (application-level gateway)
Operating at Layer 7 of the OSI model, a proxy firewall acts as an intermediary that terminates the client connection, inspects the request, then opens a separate connection to the server. This prevents a direct client-to-server link and allows deep application-level inspection, at the cost of some added latency.
Next-generation firewall (NGFW)
An NGFW blends traditional stateful filtering with advanced capabilities: DPI, intrusion prevention system (IPS), application awareness and control, URL filtering, Data Loss Prevention (DLP), sandboxing, Internet of Things (IoT) security, and zero-trust network access. NGFWs can be deployed as hardware, software, virtual, or cloud, and often integrate Software-Defined Wide Area Network (SD-WAN), Zero Trust Network Access (ZTNA), and Secure Access Service Edge (SASE).
Web application firewall (WAF)
A WAF is a reverse proxy that sits in front of web applications and filters HTTP traffic, blocking attacks such as SQL injection, cross-site scripting (XSS), and cross-site request forgery. It protects the application from malicious users, complementing network firewalls that protect the network from malicious traffic.
UTM, virtual, cloud-native, and firewall-as-a-service
Unified Threat Management (UTM) devices bundle firewalling with antivirus and intrusion prevention for simplicity. Virtual firewalls run as software on hypervisors or in the cloud and support network segmentation and multi-tenancy. Cloud-native firewalls are built for specific cloud platforms like AWS, Azure, and Google Cloud. Firewall-as-a-Service (FWaaS) delivers firewall capability from the cloud on a subscription basis, which scales easily and suits distributed, multi-cloud environments. Some organizations also opt for a managed firewall, outsourcing continuous tuning and monitoring to a provider.
Firewall types compared
Choosing the right firewall means matching its inspection depth, performance, and best-fit use case to your environment.
Hardware, software, and cloud firewalls
Beyond inspection method, firewalls differ in form factor. A hardware firewall is a physical appliance placed between networks, favored on large networks where software alone would consume too much processing power. A software firewall runs on a server, virtual machine, or individual device (a host-based or personal firewall), controlling traffic for that system. A cloud firewall or FWaaS is hosted in the cloud and is far better suited to protecting cloud and multi-cloud assets than a physical appliance. Originally almost all firewalls were hardware; today many are software-based or cloud-delivered, and large environments typically combine all three, ideally managed through a single console to avoid gaps.
Firewall features: NAT and VPN
Firewalls often provide two network functions worth calling out. Network Address Translation (NAT) rewrites the source or destination IP addresses of packets as they pass through, letting many devices share one public IP address and hiding internal addresses from the internet, which doubles as a defense against reconnaissance. A Virtual Private Network (VPN) extends a private network across a public one through an encrypted tunnel, so remote users can securely access corporate resources as if directly connected. This is especially valuable for hybrid and remote work.
Firewall vs. antivirus vs. WAF
Firewalls are frequently confused with other security tools. A firewall controls network traffic and blocks unauthorized access at the network level. Antivirus works at the device level, scanning files and memory to detect and remove malware that is already present. A WAF is a specialized firewall focused on the application layer, protecting web apps from attacks like SQL injection and XSS. These are complementary, not interchangeable: most organizations run a network firewall and antivirus together, and add a WAF when they host web applications. A firewall also differs from an intrusion detection system (IDS), which only monitors and alerts, and an IPS, which blocks known attacks inline. It is not a router, which simply directs traffic, or a plain ACL, which is packet-level filtering with no deep inspection.
Why firewalls matter
A firewall is widely considered the first line of defense in network security. It blocks unauthorized access and common threats such as viruses, backdoors, phishing traffic, and denial-of-service attempts, and it can restrict outbound traffic to limit data exfiltration by insiders or compromised hosts. Firewalls also help organizations meet compliance requirements, since many regulatory frameworks mandate their use to protect sensitive data, and they support access control through the principle of least privilege, granting users and systems only the access they need. A firewall shrinks the attack surface and enforces a clear boundary around what is allowed on the network.
Firewall best practices and challenges
A firewall requires ongoing management and tuning. Effective firewall management follows a few core practices:
- Apply least privilege to rules: Replace overly permissive "any/any" rules with explicit allow and deny statements.
- Document everything: Keep clear, current documentation of every rule and its purpose.
- Patch and update regularly: Apply updates and patches on a consistent schedule.
- Protect the firewall itself: Disable insecure management protocols and back up configurations.
- Group and segment rules: Organize rules for clarity and oversight.
- Monitor and audit continuously: Review logs for suspicious activity and remove stale rules.
The common challenges mirror these practices:
- Misconfiguration: Overly permissive rules or missed updates are among the most dangerous and frequent issues.
- Rule set bloat: New policies accumulate over time while old ones linger, creating conflicting configurations that hurt performance and can generate false positives.
- Performance overhead: Deep inspection, encrypted-traffic analysis, and advanced features all demand processing power, so an undersized firewall becomes a bottleneck.
- Update risk: Even routine updates carry risk if poorly timed or tested.
Expert insight: a firewall is a control point, not a detection engine
A firewall is fundamentally a preventive control: it enforces who and what may cross a boundary. That is essential, but modern attackers increasingly operate with valid credentials and legitimate tools, and a growing share of intrusions are malware-free, so plenty of malicious activity looks like allowed traffic to a firewall. Once something is past the perimeter, the firewall was never designed to hunt it down. Detection and response is a separate discipline, and it is where a firewall stops and a Security Operations Center (SOC) platform begins.
Sekoia treats the firewall as one high-value telemetry source among many rather than the whole defense. Firewall logs are one of the more than 300 integrations that feed the Sekoia unified SOC platform, where the Sekoia Defend Security Information and Event Management (SIEM) correlates them with endpoint, identity, and cloud data, and where roughly 1,000 detection rules mapped to MITRE ATT&CK turn raw firewall events into high-confidence detections. Those detections are enriched by native Sekoia Intelligence Cyber Threat Intelligence (CTI), produced by an in-house Threat Detection & Research (TDR) team, which keeps false positives low and helps analysts see the east-west movement a firewall alone would miss. As a European vendor, Sekoia also offers a data sovereignty posture that large US-based providers rarely match, paired with automated incident response so that a signal from the firewall can trigger containment in minutes. Keep the firewall as your first line, but do not mistake prevention for detection.
Frequently asked questions
What is a firewall in simple terms?
A firewall is a security system that monitors network traffic and decides what to allow or block based on a set of rules. It sits between a trusted network and an untrusted one, such as the internet, and acts as a barrier that keeps unauthorized users and malicious data out while letting legitimate traffic through.
What is a firewall in computing?
In computing, a firewall is a network security device or software that filters data packets moving in and out of a network or device. It inspects each packet against predefined rules (such as IP address, port, and protocol) and permits or denies it accordingly, protecting systems from unauthorized access and network-based threats.
How does a firewall work?
A firewall inspects data packets as they try to cross a network boundary and compares them to security rules. Simple firewalls check packet headers; stateful firewalls also track the context of the whole connection; and next-generation firewalls use DPI to examine packet contents and apply threat intelligence. Packets that match an allow rule pass; those that violate the rules are blocked or dropped.
What are the main types of firewalls?
The main types by inspection method are packet filtering, stateful inspection, proxy (application-level gateway), NGFW, and WAF. Firewalls also come in different form factors (hardware, software, virtual, cloud) and deployment models such as UTM and FWaaS.
What is the difference between hardware and software firewalls?
A hardware firewall is a physical appliance placed between networks, typically used on larger networks where it can handle heavy traffic without taxing other systems. A software firewall runs on a server, virtual machine, or individual device and controls traffic for that system. Many organizations use both, often alongside a cloud firewall.
What is the difference between a stateful and a stateless firewall?
A stateless firewall inspects each packet on its own, with no memory of prior packets, so it cannot tell if a packet belongs to an existing connection. A stateful firewall tracks the state and context of active connections, which lets it make smarter decisions and offer stronger protection, though it uses more processing power.
What is the difference between a firewall and antivirus?
A firewall controls network traffic and blocks unauthorized access at the network level. Antivirus operates on individual devices, scanning for and removing malware that is already present. They protect different layers and are complementary, so most organizations deploy both.
What is a next-generation firewall (NGFW)?
An NGFW combines traditional stateful firewall capabilities with advanced features such as DPI, intrusion prevention, application and identity awareness, URL filtering, and threat intelligence. This lets it detect threats that basic firewalls miss and enforce more granular, application-aware policies.
Is a firewall enough to protect a network?
No. A firewall is a critical first line of defense, but it is a preventive control focused on the perimeter. It does not, by itself, detect and respond to threats that get inside, especially attacks using valid credentials or legitimate tools. A layered strategy pairs firewalls with detection and response, such as a SIEM or SOC platform, threat intelligence, and endpoint protection.
What is a cloud firewall or firewall-as-a-service (FWaaS)?
A cloud firewall, often delivered as FWaaS, provides firewall protection from the cloud rather than a physical appliance. It forms a virtual barrier around cloud platforms, infrastructure, and applications, scales easily, and is generally better suited to protecting cloud and multi-cloud assets than traditional hardware firewalls.