Suricata
Suricata is the open-source engine behind a large share of the world's network detection. It inspects traffic in real time, matches it against rules, and writes structured alerts you can feed straight into a SIEM.
What it is
Suricata is an IDS/IPS and network security monitoring engine. It sits on a network tap or inline in the traffic path and does three things: decodes packets, matches them against a rule set, and logs what it finds.
As an IDS (intrusion detection system) it watches a copy of the traffic and alerts — it cannot stop anything. As an IPS (intrusion prevention system) it sits inline and can drop packets that match a rule. The same engine does both; the difference is deployment and one configuration flag.
It is developed by the Open Information Security Foundation (OISF) and is the modern successor to Snort's role, with a key architectural advantage: multi-threading. It also understands application-layer protocols — HTTP, TLS, DNS, SMB, SSH, FTP, SMTP — so rules can match on parsed fields like a URI or a DNS query name, not just raw bytes.
Everything it produces is structured. The eve.json log is one JSON object per line covering alerts, flows, DNS queries, TLS certificates and file transfers — which is why Suricata pairs naturally with Splunk, Elastic or Wazuh.
How to use Suricata
Follow it exactly as you would in a real session — every command, every line of output, and what each result actually tells you. This is a terminal walkthrough.
Set HOME_NET — the one setting that matters
root@errordex:/etc/suricata# grep -A3 "^vars:" suricata.yaml
vars:
address-groups:
HOME_NET: "[192.168.1.0/24]"
EXTERNAL_NET: "!$HOME_NET"
# HOME_NET = YOUR network. Everything else is external.Update the rules and test the config
root@errordex:/etc/suricata# suricata-update && suricata -T -c /etc/suricata/suricata.yaml
Loading rule file: /var/lib/suricata/rules/suricata.rules Configuration provided was successfully loaded. Exiting. # -T = test only, do not run. Always test before starting.
Run against a pcap before going live
root@errordex:# suricata -r capture.pcap -c /etc/suricata/suricata.yaml -l /tmp/out
[INFO] Loading rule file: /var/lib/suricata/rules/suricata.rules [INFO] 50213 signatures processed [INFO] RunMode: Single [INFO] Alerts: 7 Flows: 412 DNS: 88 TLS: 31
Read the alerts and count by signature
root@errordex:# jq -r 'select(.event_type=="alert")|.alert.signature' eve.json | sort | uniq -c | sort -rn
4 ET SCAN Potential SSH Scan 2 ET EXPLOIT vsftpd 2.3.4 Backdoor Command Execution 1 ET POLICY Outdated Windows Flash Version Check
Write a local rule and test it
root@errordex:# suricata -T -c /etc/suricata/suricata.yaml -S local.rules
alert http $EXTERNAL_NET any -> $HOME_NET any (msg:"Admin panel access"; \ flow:to_server,established; content:"GET"; http_method; \ content:"/admin"; http_uri; sid:1000001; rev:1;) Configuration provided was successfully loaded.
Flags & options
| FLAG | WHAT IT DOES |
|---|---|
| -i eth0 | Capture on a live interface. |
| -r file.pcap | Read a capture file — safest way to learn. |
| -c suricata.yaml | Configuration file. |
| -l /path | Log directory for eve.json and fast.log. |
| -T | Test the configuration and rules, then exit. |
| -S local.rules | Load only this rule file (used for testing). |
| -D | Run as a daemon in the background. |
| HOME_NET | Defines your network — the most important variable. |
| eve.json | Structured output: alerts, flows, DNS, TLS, files. |
| fast.log | One line per alert, human readable. |
| sid | Unique rule ID. Local rules: 1000000+. |
| rev | Rule revision number — bump it on every change. |
Why it matters
Most intrusions are visible on the wire before they are visible anywhere else. Suricata is how you see them — but an untuned sensor is worse than none, because it trains everyone to ignore alerts. The skill is not writing thousands of rules; it is keeping ten that fire when they should.
How it works
Traffic flows through the engine in stages: capture → decode → stream reassembly → protocol parsing → rule matching → output.
Stream reassembly matters more than people expect. A rule that matches "GET /admin" will miss a request split across packets unless the engine reassembles the TCP stream first — which Suricata does by default, and which attackers try to evade.
Rules are the detection logic, and they follow a fixed structure:
action protocol source_ip source_port -> dest_ip dest_port (options)
The action is alert (IDS) or drop/reject (IPS). The options carry the actual signature: msg (the alert text), content (bytes to match), flow (direction and state), sid (unique rule ID), rev (revision), and often classtype and metadata.
HOME_NET is the single most important setting in the whole configuration: it tells Suricata which addresses are yours. Get it wrong and every rule fires in the wrong direction, producing alerts that make no sense.
Passive. Sees a copy of traffic, writes alerts, cannot block. Safe to deploy anywhere.
IPSInline. Traffic passes through it and matching packets can be dropped. Powerful and dangerous — a bad rule drops real business traffic.
RULERun IDS for weeks, tune it, then consider inline.
alert http $EXTERNAL_NET any -> $HOME_NET any — action, protocol, source, direction, destination.
msg text · flow direction/state · content bytes to match · http_uri where to look · sid unique ID · rev revision.
Never reuse a sid. Local rules start at 1000000.
One human-readable line per alert. Good for quick triage.
eve.jsonStructured JSON: alerts, flows, DNS, TLS, files. This is what goes to a SIEM.
RULEDo not build workflows on fast.log — it is a convenience, not the record.
Commands & syntax
# Debian / Ubuntu / Kali sudo apt install suricata sudo suricata-update # fetch the Emerging Threats rule set # run against a live interface sudo suricata -i eth0 -c /etc/suricata/suricata.yaml # or against a pcap file (best for learning) sudo suricata -r capture.pcap -c /etc/suricata/suricata.yaml
# /etc/suricata/suricata.yaml — set this to YOUR network HOME_NET: "[192.168.1.0/24,10.0.0.0/8]" EXTERNAL_NET: "!$HOME_NET" # confirm the interface and the rule path af-packet: - interface: eth0 rule-files: - suricata.rules
# fast.log — one line per alert, human readable sudo tail -f /var/log/suricata/fast.log # eve.json — the real output; jq makes it readable sudo tail -f /var/log/suricata/eve.json | jq 'select(.event_type=="alert") | {time, src_ip, dest_ip, alert:.alert.signature}' # count alerts by signature sudo cat /var/log/suricata/eve.json | jq -r 'select(.event_type=="alert") | .alert.signature' | sort | uniq -c | sort -rn
# alert on a request to /admin from outside HOME_NET alert http $EXTERNAL_NET any -> $HOME_NET any (msg:"Possible admin panel access"; \ flow:to_server,established; content:"GET"; http_method; content:"/admin"; http_uri; \ classtype:web-application-activity; sid:1000001; rev:1;) # test rules without touching live traffic sudo suricata -T -c /etc/suricata/suricata.yaml -S local.rules
root@errordex:/var/log/suricata# tail -f eve.json | jq 'select(.event_type=="alert") | {time, src_ip, dest_ip, sig:.alert.signature}' { "time": "2026-11-11T09:52:03.441+05:30", "src_ip": "203.0.113.44", "dest_ip": "10.0.0.14", "sig": "ET SCAN Potential SSH Scan" } { "time": "2026-11-11T09:52:07.118+05:30", "src_ip": "203.0.113.44", "dest_ip": "10.0.0.14", "sig": "ET EXPLOIT vsftpd 2.3.4 Backdoor Command Execution" } # Two alerts, seven seconds apart, same source. # First: someone is scanning. Second: they found the door. # Correlate by src_ip and the story writes itself.
Common mistakes
Wrong HOME_NET
The most common misconfiguration and the cause of most "why is everything alerting" questions.
Running every rule set at once
Tens of thousands of rules produce an unreadable wall of alerts.
Never tuning
Untuned alerts get ignored, and ignored alerts are how real intrusions go unnoticed.
Going inline too early
A badly tuned IPS drops legitimate business traffic — that is an outage you caused.
Ignoring encrypted traffic
Without TLS metadata or a feed of JA3 fingerprints, much of modern traffic is invisible.
Treating an alert as a fact
An alert is a hypothesis: something matched a signature. The investigation is yours.
Practice safely
Best free lab: SELKS — a Suricata + Elasticsearch + Kibana distribution maintained by Stamus Networks, shipped as a ready-to-run ISO or Docker stack. It gives you a full NSM setup in one install.
Safe testing: capture traffic with tcpdump -w capture.pcap on your own lab network, then replay it into Suricata with -r. You can iterate on rules without touching live traffic.