ERROR DEXby Akshay kumar
STUDY MODE / DEFENSIVE / SURICATA
DEFENSIVE · IDS / IPS

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.

HOME_NET wrong means every rule evaluates in the wrong direction — the classic misconfiguration.
Untuned rules train your team to ignore alerts, which is how incidents get missed.
An alert is a hypothesis, not a fact. The investigation is still yours.
HOW TO USE IT →WHY IT MATTERSCOMMANDSMISTAKES
LICENCEOpen source (GPLv2)
PLATFORMLinux · FreeBSD · Windows
WRITTEN INC
MAINTAINED BYOISF

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.

WALKTHROUGH

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.

01

Set HOME_NET — the one setting that matters

KALI LINUX
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.
WHAT THIS MEANSRules are written as "external → home" or "home → external". If HOME_NET is wrong, every rule evaluates in the wrong direction and your alerts become meaningless. This is the number-one misconfiguration.
02

Update the rules and test the config

KALI LINUX
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.
WHAT THIS MEANSA config that fails to load silently runs with no rules — you think you are protected and you are not. Always -T first.
03

Run against a pcap before going live

KALI LINUX
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
WHAT THIS MEANSReplaying a capture is how you learn without risking live traffic. Seven alerts from 412 flows — now you can read every one of them and decide whether each is real.
04

Read the alerts and count by signature

KALI LINUX
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
WHAT THIS MEANSThe counts tell the story. Four scans, then an exploit attempt — same source, seven seconds apart. The third one is likely a false positive from a legacy machine; that is the one you tune, not disable.
05

Write a local rule and test it

KALI LINUX
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.
WHAT THIS MEANSLocal rule IDs start at 1000000 so they never collide with the vendor set. Test with -S before adding it to the live config.

Flags & options

FLAGWHAT IT DOES
-i eth0Capture on a live interface.
-r file.pcapRead a capture file — safest way to learn.
-c suricata.yamlConfiguration file.
-l /pathLog directory for eve.json and fast.log.
-TTest the configuration and rules, then exit.
-S local.rulesLoad only this rule file (used for testing).
-DRun as a daemon in the background.
HOME_NETDefines your network — the most important variable.
eve.jsonStructured output: alerts, flows, DNS, TLS, files.
fast.logOne line per alert, human readable.
sidUnique rule ID. Local rules: 1000000+.
revRule 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.

IDS

Passive. Sees a copy of traffic, writes alerts, cannot block. Safe to deploy anywhere.

IPS

Inline. Traffic passes through it and matching packets can be dropped. Powerful and dangerous — a bad rule drops real business traffic.

RULE

Run IDS for weeks, tune it, then consider inline.

HEADER

alert http $EXTERNAL_NET any -> $HOME_NET any — action, protocol, source, direction, destination.

OPTIONS

msg text · flow direction/state · content bytes to match · http_uri where to look · sid unique ID · rev revision.

RULE

Never reuse a sid. Local rules start at 1000000.

fast.log

One human-readable line per alert. Good for quick triage.

eve.json

Structured JSON: alerts, flows, DNS, TLS, files. This is what goes to a SIEM.

RULE

Do not build workflows on fast.log — it is a convenience, not the record.

NETWORK TAPeth0DECODE + STREAMreassemblePROTOCOL PARSEhttp · dns · tlsRULE MATCHthousands of rulesALERT / DROPactioneve.json→ SIEM
Decode and reassemble traffic, parse the protocol, match rules, write structured alerts

Commands & syntax

INSTALL AND FIRST RUN
# 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
THE ONE SETTING THAT MATTERS
# /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
READING THE ALERTS
# 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
WRITE YOUR OWN RULE
# 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
KALI LINUX · errordex
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.

Legal note. Only use Suricata on systems you own or have explicit written permission to test. In India, unauthorised access is punishable under sections 43 and 66 of the IT Act, 2000. Every example on this page assumes a lab environment.

Related