Free tech learning for everyone, from basics to pro

Network SecurityNetworking SecurityIntermediate

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

TypeHow it decidesStrengthsLimitations
Packet filtering (stateless)Checks each packet's addresses, protocol and ports against rulesFast, simple, cheap (router ACLs)No memory of connections; easy to fool; can't see content
StatefulTracks each connection in a state table and only allows packets that belong to a valid sessionBlocks out-of-context packets; return traffic allowed automaticallyDoesn't inspect application content
Application gateway (proxy)Acts on behalf of the client and inspects the application dataDeep control, can authenticate usersSlower; one proxy per application
NAT firewallHides internal addresses and only allows replies to inside-initiated trafficSimple protection for home and small networksLimited 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)

IDS works on a copy of traffic; IPS sits inlineIDS: out of bandIPS: inlineInternetSwitchLANIDSalerts onlySPAN copyInternetIPSLANevery packet passes through;malicious packets are dropped
Figure 1. An IDS analyses a copy of traffic and reports; an IPS sits in the path and can block attacks immediately.

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?
It checks the packet belongs to an existing, valid connection in its state table; a stateless filter only checks the header against rules.
Which device can stop an attack immediately: IDS or IPS? Why?
IPS, because it sits inline in the traffic path; an IDS only sees a copy.

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.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

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.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.