Suricata
Overview
Suricata is an open source network threat detection engine that can operate as an Intrusion Detection System (IDS), Intrusion Prevention System (IPS), and Network Security Monitor (NSM). It's developed by the Open Information Security Foundation (OISF) and has become the go-to choice over Snort for a few practical reasons: native multi-threading support, built-in protocol detection regardless of port, and first-class JSON logging output that plays nicely with modern log pipelines. It also supports Snort rules directly so migration is straightforward.
Installation
Most distributions package Suricata directly. The package name is typically just suricata:
You'll also want the rule update tool:
Configuration
The main configuration file lives at /etc/suricata/suricata.yaml. It's a big file but only a handful
of settings need attention for most deployments.
HOME_NET and EXTERNAL_NET
Define what Suricata considers your internal network. This directly affects how rules match traffic:
Narrow this down to your actual network ranges for better accuracy and fewer false positives.
Interface Settings
Configure the capture interface depending on your mode. For AF_PACKET (the most common on Linux):
Rule Paths
Tell Suricata where to find rule files:
The suricata-update tool manages files in this location by default.
EVE JSON Logging
EVE (Extensible Event Format) is the modern logging output and should be your primary log source. It produces structured JSON that's easy to parse and ship to log aggregation systems:
This gives you alerts plus protocol-level metadata for HTTP, DNS, TLS, and flow records all in one structured log stream.
IDS Mode (Passive Monitoring)
In IDS mode Suricata passively observes a copy of network traffic without being in the path. This is the safest way to start since dropping or mangling traffic isn't possible. You'll need traffic fed to your monitoring interface through a mirror/SPAN port on your switch, a network TAP, or a virtual bridge in a hypervisor.
Running with AF_PACKET
AF_PACKET is the standard capture method on Linux. It's fast, supports zero-copy with mmap, and doesn't need any extra kernel modules:
For dedicated monitoring interfaces, bring the interface up without an IP address so it operates in promiscuous mode only:
| |
IPS Mode (Inline / Transparent Bridge)
In IPS mode Suricata sits directly in the traffic path and can drop, reject, or modify packets based on rules. The classic approach uses a transparent bridge with two dedicated NICs. Traffic enters one interface, crosses the bridge through Suricata's inspection, and exits the other.
Bridge Configuration with systemd-networkd
Create network configuration files for the two physical interfaces and the bridge. Replace eth1 and
eth2 with your actual interface names.
/etc/systemd/network/10-br-ips.netdev
/etc/systemd/network/20-eth1.network
/etc/systemd/network/20-eth2.network
/etc/systemd/network/30-br-ips.network
Apply the configuration:
| |
Sysctl Settings
Enable forwarding for both IPv4 and IPv6, and turn on bridge netfilter support so Suricata can inspect bridged traffic:
Drop these into /etc/sysctl.d/90-suricata-bridge.conf and apply:
| |
You may also need to load the br_netfilter kernel module:
nftables Rules for Bridge Forwarding
Set up nftables to allow all traffic across the bridge. This replaces the old iptables approach:
For a persistent configuration, create /etc/nftables.d/bridge-ips.nft (or add to your existing
nftables config):
table bridge filter {
chain forward {
type filter hook forward priority 0; policy accept;
# Accept all traffic across the IPS bridge
ibrname "br-ips" accept
obrname "br-ips" accept
}
}Running Suricata in IPS Mode
Configure Suricata to use NFQ (netfilter queue) or AF_PACKET in inline mode:
| |
Start it up:
| |
The copy-mode: ips setting means Suricata will forward packets between the two interfaces, dropping
anything that matches a drop rule action.
Network Requirements
| Port/Protocol | Direction | Description |
|---|---|---|
| N/A (passive tap) | Inbound | Mirrored traffic for IDS mode |
| Bridge forwarding | Through | All traffic passes through in IPS mode |
| TCP 443 (HTTPS) | Outbound | Rule updates via suricata-update |
| TCP/UDP 53 (DNS) | Outbound | DNS resolution for update servers |
Suricata itself doesn't listen on any ports. In IDS mode it only reads from a capture interface. In IPS mode it forwards traffic between bridge members.
Rule Management
The suricata-update tool handles downloading, merging, and managing rulesets. The Emerging Threats
Open ruleset is free and a solid starting point:
| |
Rules land in /var/lib/suricata/rules/suricata.rules by default. You can customize which rules are
enabled or disabled:
Testing
Configuration Validation
Always validate your config before starting Suricata in production:
| |
This parses the config, loads all rules, and reports any errors without actually starting the engine.
Testing with Sample PCAPs
You can replay packet captures through Suricata to verify rules trigger correctly:
The Suricata project and Emerging Threats both provide test pcaps. You can also grab samples from places like malware-traffic-analysis.net for more realistic testing.
Log Analysis
EVE JSON logs live at /var/log/suricata/eve.json by default. Since everything is structured JSON, you
can do quick analysis with jq right on the box:
| |
For anything beyond quick spot checks, shipping EVE logs into a proper stack is worth the effort. Elasticsearch and Kibana (the ELK stack) with Filebeat is the most common setup. There's also Arkime (formerly Moloch) for full packet capture and indexed search alongside Suricata alerts. For something lighter weight, Grafana Loki can ingest EVE JSON and give you dashboards without the resource overhead of Elasticsearch.
Looking for something specific?