Security fundamentals

What Is a Firewall?

By the NexusSec engineering team · 7 min read · Updated July 2026
A firewall is a security device or software that controls which network traffic is allowed in and out of a network, based on a set of rules. It sits between your internal network and the internet, examining every packet and permitting or blocking it. Modern next-generation firewalls go further, identifying the application and user behind traffic, inspecting encrypted connections, and blocking known attacks in real time.

How a firewall works

Every piece of data crossing a network is broken into packets, each carrying a source address, a destination address, a port number and a payload. A firewall inspects these packets and compares them against its rule set — its policy — then takes one of three actions: allow, deny (silently drop), or reject (drop and notify the sender).

The rules are evaluated in order, top to bottom, and the first match wins. Most firewalls end with an implicit "deny everything else", which is why a properly designed policy explicitly permits only what is needed.

The generations of firewall

1. Packet-filtering firewalls

The earliest type. They examine each packet in isolation against source and destination addresses and ports. Fast, but they have no memory — they cannot tell whether a packet belongs to a legitimate ongoing conversation.

2. Stateful inspection firewalls

These track the state of active connections. If your computer initiates a request to a web server, the firewall remembers that and allows the reply back — while blocking an unsolicited inbound packet pretending to be a reply. This is the baseline expectation for any firewall today.

3. Next-generation firewalls (NGFW)

NGFWs add application awareness (recognising that traffic is a specific application regardless of the port it uses), user identity awareness, integrated intrusion prevention, TLS/SSL inspection, and threat-intelligence feeds. This is what businesses deploy in 2026 — see our NGFW vs UTM explainer.

4. Web application firewalls (WAF)

A different category. A WAF sits in front of a web application and inspects HTTP requests specifically, blocking attacks such as SQL injection and cross-site scripting. A WAF complements a network firewall; it does not replace it.

Hardware, software and cloud firewalls

TypeWhere it runsTypical use
Hardware applianceDedicated device at the network edgeProtecting an office or data centre perimeter
Software / host firewallOn the endpoint or server itselfProtecting an individual machine
Virtual firewallAs a VM in a hypervisorVirtualised data centres, segmentation between VMs
Cloud firewallDelivered as a serviceCloud workloads and distributed users

What a firewall protects against

What a firewall does not protect against

A firewall is a boundary control. It does not stop a user entering credentials into a convincing phishing page, malware arriving on a USB drive, an attacker using stolen valid credentials through your VPN, an insider misusing legitimate access, or threats inside encrypted traffic it has not been configured to inspect. Firewalls are necessary, not sufficient.

Why configuration matters more than brand

In the assessments we run, the majority of firewall weaknesses are not product flaws. They are overly permissive "any-any" rules added during troubleshooting and never removed, intrusion prevention left in monitor-only mode, TLS inspection never enabled, no segmentation between user and server networks, and firmware years out of date.

A mid-range firewall configured and maintained properly provides far better protection than a flagship appliance running defaults. If your rule base has never been reviewed, a firewall audit is usually the highest-value place to start.

The bottom line

A firewall enforces which traffic is allowed to cross a network boundary. Modern next-generation firewalls understand applications, users and content rather than just ports and addresses. They are an essential control — but they work alongside endpoint protection, patching, multi-factor authentication and segmentation, not instead of them.

Frequently asked questions

What is a firewall in simple terms?

A firewall is a security control that decides which network traffic is allowed in and out, based on rules. It sits between your network and the internet and examines traffic, allowing what your policy permits and blocking everything else. Think of it as a checkpoint that inspects every packet trying to cross a boundary.

What is the difference between a firewall and antivirus?

A firewall controls network traffic crossing a boundary, deciding what may enter or leave. Antivirus, and its modern successor endpoint protection, runs on a device and detects malicious software on that device. They protect different layers, and businesses need both.

What is a next-generation firewall?

A next-generation firewall makes decisions based on the application, the user identity and the content of traffic, not just port and IP address. It includes integrated intrusion prevention, can decrypt and inspect TLS traffic, and uses threat intelligence. Traditional firewalls filter primarily on network-layer attributes.

Do I need a firewall if I have a router?

Most business routers include basic firewall functionality, but it is usually limited to simple stateful filtering and NAT. It typically lacks intrusion prevention, application awareness, TLS inspection, web filtering, centralised logging and segmentation. For a business, a dedicated firewall provides materially better protection and visibility.

Can a firewall stop ransomware?

It helps significantly but cannot stop ransomware alone. A firewall can block known command-and-control destinations, prevent exposed remote-access services being attacked, and limit lateral movement through segmentation. However, ransomware often arrives through phishing or stolen credentials. Effective defence also requires endpoint protection, patching, multi-factor authentication and tested offline backups.

Want your firewall configured properly?

NexusSec designs, deploys and audits next-generation firewalls for businesses across Navi Mumbai, Mumbai and India.

Explore Firewall & Network Security