capture.pcap
packet capture
No.  Source         Destination    Proto  Info
1    192.0.2.10     198.51.100.7   DNS    Standard query A example.com
2    198.51.100.7   192.0.2.10     DNS    Standard query response
3    192.0.2.10     203.0.113.5    TCP    52144 → 443 [SYN]
4    203.0.113.5    192.0.2.10     TCP    443 → 52144 [SYN, ACK]
5    192.0.2.10     203.0.113.5    TLS    Client Hello
Illustration · Signal
tool

Suricata: open-source network intrusion detection

Inspects network traffic for attacks using rule sets and protocol logging.

Curated by Signal · 10/5/2026

Original: suricata.io ↗License: GPL-2.0Repository ↗

What it is

Suricata inspects network traffic in real time and raises alerts when it matches known attack patterns (an IDS), and it can also block traffic inline (an IPS). It also logs protocol details such as DNS, HTTP, and TLS, which makes it useful for investigation as well as detection.

Running Suricata

# Run against a live interface
suricata -i eth0
 
# Run against a saved capture file
suricata -r capture.pcap
 
# Run with a specific config file
suricata -c /etc/suricata/suricata.yaml -i eth0
 
# Run as a background daemon
suricata -D -i eth0

Rule management

# Test the configuration and rules for errors
suricata -T -c /etc/suricata/suricata.yaml
 
# Update rulesets (using suricata-update)
suricata-update
 
# List enabled rule sources
suricata-update list-sources
 
# Enable a specific ruleset
suricata-update enable-source et/open
 
# Apply updated rules
suricata-update
suricata -c /etc/suricata/suricata.yaml --list-keywords

Rule syntax basics

# A simple alert rule: detect any traffic to a specific port
alert tcp any any -> any 4444 (msg:"Possible reverse shell port"; sid:1000001;)
 
# Detect a string in HTTP traffic
alert http any any -> any any (msg:"Suspicious user agent"; http.user_agent; content:"sqlmap"; sid:1000002;)
 
# Detect a DNS query to a specific domain
alert dns any any -> any any (msg:"DNS query to suspicious domain"; dns.query; content:"malicious-example.com"; sid:1000003;)

Custom rules

# Add a custom rule file in suricata.yaml under rule-files:
# - custom.rules
 
# Then place rules in:
# /etc/suricata/rules/custom.rules
 
# Reload rules without restarting (if enabled)
kill -USR2 $(pidof suricata)

Logs (EVE JSON format)

# EVE log location (configured in suricata.yaml)
tail -f /var/log/suricata/eve.json
 
# Pretty-print the latest alert
tail -n 1 /var/log/suricata/eve.json | jq .
 
# Filter only alert events
jq 'select(.event_type=="alert")' /var/log/suricata/eve.json
 
# Filter only DNS events
jq 'select(.event_type=="dns")' /var/log/suricata/eve.json
 
# Filter only HTTP events
jq 'select(.event_type=="http")' /var/log/suricata/eve.json

Useful jq queries

# List all alert messages seen
jq -r 'select(.event_type=="alert") | .alert.signature' /var/log/suricata/eve.json | sort | uniq -c
 
# List all source IPs that triggered alerts
jq -r 'select(.event_type=="alert") | .src_ip' /var/log/suricata/eve.json | sort | uniq -c
 
# Show all flows to a specific destination port
jq 'select(.dest_port==4444)' /var/log/suricata/eve.json

Performance and modes

# Run in IDS mode (default, detect and log only)
suricata -i eth0
 
# Run in IPS mode with nfqueue (requires iptables setup)
suricata -q 0
 
# Check runtime stats
suricata --dump-config

Typical workflow

# 1. Validate config and rules before deploying
suricata -T -c /etc/suricata/suricata.yaml
 
# 2. Start monitoring an interface
suricata -D -i eth0 -c /etc/suricata/suricata.yaml
 
# 3. Watch alerts in real time
tail -f /var/log/suricata/eve.json | jq 'select(.event_type=="alert")'
 
# 4. Investigate a flagged source IP across all logged protocols
jq 'select(.src_ip=="192.0.2.10")' /var/log/suricata/eve.json

Curated summary. The original work belongs to its authors.

#ids#network#defense
Related reading