Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
Know it before you install
Suricata captures packets (AF_PACKET on Linux), rebuilds flows and protocols, and matches rules like alert http any any -> $HOME_NET any (msg:"…"; content:"…"; sid:…;). Everything is logged as JSON in EVE (eve.json): alerts, DNS queries, HTTP requests, TLS handshakes, flows.
| Item | Value |
|---|---|
| Packages | suricata (RHEL: EPEL or OISF COPR; Ubuntu: OISF PPA) |
| Service | suricata.service |
| Config | /etc/suricata/suricata.yaml; interface options in /etc/sysconfig/suricata (RHEL) or /etc/default/suricata (Ubuntu) |
| Rules | /var/lib/suricata/rules/suricata.rules (made by suricata-update), your own in /etc/suricata/rules/local.rules |
| Logs | /var/log/suricata/eve.json, fast.log, stats.log, suricata.log |
| Where to run | on a host that sees the traffic: a gateway, a SPAN/mirror port or a TAP |
Install on RHEL, Rocky, Alma and Fedora
For the newest stable version use the OISF COPR: dnf copr enable @oisf/suricata-8.0 before the install.
Install on Ubuntu and Debian
apt-get install -y software-properties-common
add-apt-repository -y ppa:oisf/suricata-stable
apt-get update
apt-get install -y suricata jqFirst configuration: interface, home network, rules
Find the interface that sees the traffic (ip -br link), then set it and your networks:
vars:
address-groups:
HOME_NET: "[10.0.0.0/8,192.168.0.0/16]"
EXTERNAL_NET: "!$HOME_NET"
af-packet:
- interface: eth0
cluster-id: 99
cluster-type: cluster_flow
defrag: yes
default-rule-path: /var/lib/suricata/rules
rule-files:
- suricata.rules
- /etc/suricata/rules/local.rules
community-id: trueOPTIONS="--af-packet=eth0 --user suricata"(On Ubuntu the same idea is in /etc/default/suricata: IFACE=eth0.)
| Setting | Why |
|---|---|
HOME_NET | Your networks — most rules use it to know inside from outside. Wrong value = missed or wrong alerts. |
af-packet interface | Where Suricata listens. |
rule-files | The ET Open rules from suricata-update + your own local rules. |
community-id: true | A flow ID that is the same in Suricata, Zeek and many SIEMs — easy correlation. |
Turn off NIC offloading on the capture interface (offloading changes packets before Suricata sees them), get the rules, test the config, start:
Test an alert
A harmless test URL returns text that matches an old rule:
curl -s http://testmynids.org/uid/index.html
uid=0(root) gid=0(root) groups=0(root)
tail -n 1 /var/log/suricata/fast.log
[**] [1:2100498:7] GPL ATTACK_RESPONSE id check returned root [**] [Classification: Potentially Bad Traffic] [Priority: 2] {TCP} …
jq -c 'select(.event_type=="alert") | {ts:.timestamp, sig:.alert.signature, src:.src_ip, dst:.dest_ip}' /var/log/suricata/eve.json | tail -3Your own rules and tuning
alert ssh $EXTERNAL_NET any -> $HOME_NET 22 (msg:"LOCAL SSH from outside to internal host"; flow:to_server,established; threshold:type limit, track by_src, count 1, seconds 600; sid:9000001; rev:1;)
alert dns $HOME_NET any -> any any (msg:"LOCAL DNS query to known bad domain"; dns.query; content:"bad-example.test"; nocase; sid:9000002; rev:1;)Use SIDs from 9,000,000 upward for your own rules. Turn off noisy rules in a disable.conf (one SID or regex per line) and apply it at every update:
echo "2013504" >> /etc/suricata/disable.conf
suricata-update --disable-conf /etc/suricata/disable.conf
suricatasc -c reload-rulesDaily use: the commands and the real uses
systemctl status suricata
tail -f /var/log/suricata/fast.log
jq -r 'select(.event_type=="alert") | .alert.signature' /var/log/suricata/eve.json | sort | uniq -c | sort -rn | head
jq -r 'select(.event_type=="dns" and .dns.type=="query") | .dns.rrname' /var/log/suricata/eve.json | sort | uniq -c | sort -rn | head
tail -n 30 /var/log/suricata/stats.log | grep -E 'capture.kernel_(packets|drops)'
suricata-updateRun suricata-update daily (a systemd timer or cron) — new threats get new rules every day.
Real uses at work:
- Network detection at the internet edge or between zones (IDS); alerts to Wazuh, Elastic or Splunk via
eve.json. - Incident response: who talked to which domain/IP, when (DNS, TLS and flow logs).
- Inline blocking (IPS) with NFQUEUE on a Linux gateway — start in IDS mode first.
Make it safe
Security checklist:
- Correct
HOME_NET; capture on the right interface (or a mirror port). - Daily rule updates; tune noise with
disable.confand thresholds, not by turning the IDS off. - Ship
eve.jsonto a central SIEM (Fluent Bit, Filebeat, Wazuh agent); rotate local logs. - Watch
capture.kernel_drops— dropped packets mean missed attacks (more CPU threads, workers mode). - IPS mode only after testing; a fail-open plan if Suricata stops.
Update and remove
Fix common problems
| Problem | Cause | Fix |
|---|---|---|
| No alerts at all | Wrong interface, no rules loaded, or the host does not see the traffic. | suricata.log shows loaded rules; check the interface; test with testmynids.org. |
No rule files match the pattern | suricata-update not run or wrong default-rule-path. | Run suricata-update; path /var/lib/suricata/rules. |
Many capture.kernel_drops | Not enough CPU or wrong capture settings. | More threads (threads in af-packet), cluster_flow, faster CPU. |
| Alerts with odd checksum issues | NIC offloading. | ethtool -K IFACE gro off lro off. |
| Too many alerts | Default rule set + wrong HOME_NET. | Fix HOME_NET; disable noisy SIDs; thresholds. |
suricata -T fails | YAML indentation or unknown key. | Read the line in the error; YAML uses spaces only. |
Next steps
- Quick how-tos: Detect network attacks.
- Where alerts go: Wazuh, Elasticsearch + Kibana, Fluent Bit.
- Host-level detection: Falco. Find open ports first: Nmap.
- Practise log investigation: Lab: investigate an SSH brute-force attack from the logs.
1Why is the HOME_NET setting so important?
Most rules decide inside vs. outside with it; a wrong value gives missed or false alerts.
2How often should you run suricata-update, and why?
Daily — new threats get new signatures every day.