What is an intrusion prevention system?
An intrusion prevention system inspects network traffic or host activity, recognises attacks and blocks them as they happen. It sits behind the firewall and looks at what allowed traffic actually contains.
How is an IPS different from a firewall?
A firewall decides by addresses, ports and connection state: may this host talk to that port? An IPS looks inside allowed traffic for patterns of attack: an exploit payload in an HTTP request, a known malware signature, a scan or a brute-force attempt. Port 443 may be open to everyone, and the IPS is what notices that one of those visitors is sending a SQL injection attempt.
Detection or prevention: how do IDS and IPS differ?
Placement and action. An intrusion detection system watches a copy of traffic and raises alerts. An intrusion prevention system sits inline, or controls the firewall, and can drop or block the offending traffic. Many tools do both: run in detection mode first to learn what would be blocked, then switch rules to prevention once you trust them.
How do IPS engines recognise attacks?
| Method | How it works | Strength | Weakness |
|---|---|---|---|
| Signatures | Match known patterns in traffic | Precise for known attacks | Misses new ones until rules update |
| Protocol analysis | Check traffic follows protocol rules | Catches malformed and evasive traffic | Needs good protocol parsers |
| Anomaly detection | Compare with a learned baseline | Can catch unknown attacks | More false positives |
| Reputation | Block known bad addresses | Cheap and fast | Attackers change addresses |
Host-based or network-based?
On rented servers, host-based is the natural choice. Each machine has a single public port, and we do not offer an appliance in front of it, so the IPS runs on the server itself. Suricata in inline mode with nftables queueing inspects traffic before it reaches services. Lighter host tools watch logs instead of packets: Fail2ban and CrowdSec read authentication and web logs and ban sources that misbehave, which covers the most common attacks at very low cost.
nft add table inet ips
nft add chain inet ips inbound '{ type filter hook input priority 10; }'
nft add rule inet ips inbound tcp dport { 80, 443 } queue num 0 bypass
suricata -c /etc/suricata/suricata.yaml -q 0 -D
The bypass flag lets traffic through if Suricata stops, so a crashed engine does not take the site down; remove it if you would rather fail closed.
How do log-based tools compare?
They act after the fact but are simple and effective. A rule that bans an address for an hour after ten failed SSH logins in ten minutes stops most password guessing; similar rules handle bots probing for admin panels. CrowdSec adds shared reputation, so an address attacking others can be blocked before it reaches you.
[sshd] enabled = true maxretry = 10 findtime = 10m bantime = 1h backend = systemd
What about false positives?
They are the main operational cost. A rule that blocks legitimate customers does more damage than many attacks. Tune in stages: run in alert-only mode for a week, review what fired, disable or adjust noisy rules, then enable blocking for rule groups you trust. Keep an allow list for your own monitoring and office addresses, and alert when blocking volume suddenly rises.
How much processing does an IPS need?
Deep inspection is processor heavy. Suricata scales across cores with worker threads; inspecting a few hundred megabits per second of web traffic is easy for a modern machine, while multi-gigabit inspection wants several dedicated cores. Encrypted traffic cannot be inspected at the packet level without terminating TLS, so place web application rules in the reverse proxy, such as ModSecurity with the OWASP Core Rule Set, where requests are visible in plain text.
How often should the rule sets change?
Update them daily. suricata-update downloads the chosen rule sets, applies your local changes and reloads the engine without a restart. Keep local adjustments, such as disabled or modified rules, in its configuration files rather than editing downloaded files, so updates do not undo them. Review new high-severity rules after each update in alert mode before trusting them to block, and record which rule sets you use so an auditor can see what was enforced.
suricata-update enable-source et/open suricata-update --no-test && suricatasc -c reload-rules
Where does an IPS fit in the layers?
Between the firewall and the application. The included DDoS filtering removes floods at the network edge, the host firewall closes unused ports, the IPS and log-based tools catch attacks within allowed traffic, and the application validates its own input. What a firewall does, Network security and Hardening a new dedicated server cover the neighbouring layers.
Related pages
What a firewall does
Firewalls explained from packets up: stateful filtering, default-deny policies, host and network firewalls, nftables examples and mistakes that lock you out.
Read moreNetwork security
Layered network security for servers on the public internet: edge filtering, host firewalls, encrypted links, segmentation without a private network and watching traffic.
Read moreHardening a new dedicated server
The first hour on a fresh machine: SSH keys, a firewall, automatic updates, brute force blocking and a habit of checking what listens.
Read moreRespond to a compromised server
What to do in the first hour after you suspect an intruder on a rented machine: contain, preserve evidence, rebuild and close the hole.
Read moreQuestions and answers
Does an IDS block attacks the way an IPS does?
No. An IDS only detects and alerts, while an IPS sits inline and can also drop the offending traffic.
Does an IPS replace a firewall?
No. The firewall controls which ports are reachable; the IPS inspects allowed traffic for attacks.
Can I run Suricata on a dedicated server?
Yes. Run it inline with nftables queueing on the host, starting in alert-only mode while you tune rules.
Is Fail2ban an intrusion prevention system?
A simple log-based one: it reads logs and bans addresses that show attack behaviour, such as repeated failed logins.
Can an IPS inspect HTTPS traffic?
Not at the packet level. Put web application rules in the reverse proxy that terminates TLS.