Firewalls, next-generation firewalls, IDS and IPS
In short: A firewall enforces an access policy between networks of different trust. Packet filters check headers, stateful firewalls track connections, application gateways inspect content, and next-generation firewalls add application awareness and IPS. An IDS watches a copy of traffic and alerts; an IPS sits inline and blocks.
What a firewall is
A firewall monitors traffic entering and leaving a network and allows or blocks it according to security rules. It forms a barrier between trusted internal networks and untrusted outside networks such as the internet, and has been the first line of defence for decades. A firewall can be hardware, software or both. Every firewall should:
- resist attacks against itself;
- be the only path between the networks it separates;
- enforce the organisation's access-control policy.
Types of firewall
| Type | How it decides | Strengths | Limitations |
|---|---|---|---|
| Packet filtering (stateless) | Checks each packet's addresses, protocol and ports against rules | Fast, simple, cheap (router ACLs) | No memory of connections; easy to fool; can't see content |
| Stateful | Tracks each connection in a state table and only allows packets that belong to a valid session | Blocks out-of-context packets; return traffic allowed automatically | Doesn't inspect application content |
| Application gateway (proxy) | Acts on behalf of the client and inspects the application data | Deep control, can authenticate users | Slower; one proxy per application |
| NAT firewall | Hides internal addresses and only allows replies to inside-initiated traffic | Simple protection for home and small networks | Limited policy control |
Next-generation firewalls (NGFW)
A next-generation firewall combines stateful inspection with much deeper awareness:
- identifies and controls individual applications and behaviours inside them;
- filters web use by site reputation and category;
- applies policy by user, device, role and application, not just IP address;
- includes NAT, VPN and an integrated intrusion prevention system;
- receives live threat intelligence to block new attacks quickly.
Intrusion Detection System (IDS)
An IDS looks for attacks and reports them. It sits out of band: it receives a copy of traffic from a switch SPAN port or a network TAP, so it doesn't slow the network. It works passively and only alerts administrators; it can't stop an attack by itself.
Intrusion Prevention System (IPS)
An IPS sits inline, usually right behind the firewall, so every packet passes through it. It analyses layer 3 and 4 traffic (and often application content) and can act immediately:
- alert the administrator;
- drop malicious packets;
- block traffic from the attacking address;
- reset the connection.
Because it is inline, an IPS can stop even single-packet attacks, but a poorly tuned IPS can also block legitimate traffic, so rules need testing.
Real-world example: an IPS in front of a hospital web server
A regional hospital publishes an appointment booking site from a server in its DMZ, behind a next-generation firewall with IPS (intrusion prevention) turned on. One evening the IPS logged and blocked a burst of requests matching a signature for a newly published vulnerability in the web framework the site used. The server had not yet been patched, because the fix had been released only two days earlier.
The security team saw the blocked events in the morning, confirmed that no request had reached the application, and fast-tracked the patch that afternoon. The firewall rules themselves were correct, since web traffic to the booking site had to be allowed; it was the IPS layer that inspected the content of that allowed traffic and stopped the attack. The team also set up an alert so that high-severity IPS blocks reach the on-call engineer straight away.
Practice
Why can a stateful firewall block a packet that a stateless filter would allow?
Which device can stop an attack immediately: IDS or IPS? Why?
Key takeaways
- Firewalls enforce access policy between networks of different trust.
- Packet filters are fast but stateless; stateful firewalls track connections; proxies inspect content.
- NGFWs add application, user and threat awareness plus IPS.
- IDS = out of band, detect and alert; IPS = inline, detect and block.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.