Tutorials · Security Operations
How to Detect Network Attacks With Suricata IDS on a Mirror Port
An intrusion detection system watches a copy of your traffic and alerts on scans, exploits and malware traffic. Install Suricata on a sensor connected to a switch mirror port.
Before you start
- A Linux sensor with two network ports (one for management, one for the mirror)
- A managed switch with port mirroring
- Ubuntu 22.04/24.04 or Debian 12
Step by step
Mirror the right traffic
Mirror the gateway uplink or server VLAN to the sensor's second port. The sensor's capture port needs no IP address.
Install Suricata
Use the distribution package (or the OISF PPA on Ubuntu for newer versions).
sudo apt update && sudo apt install -y suricataSet the capture interface and home network
In /etc/suricata/suricata.yaml set HOME_NET to your internal ranges and the af-packet interface to the mirror port.
vars: address-groups: HOME_NET: "[10.0.0.0/8,192.168.0.0/16]" af-packet: - interface: eth1
Download rules
suricata-update fetches the free Emerging Threats Open rule set.
sudo suricata-update sudo systemctl enable --now suricata
Test detection
From a test machine, request a page that triggers a well-known test rule, then check the alert log.
curl http://testmynids.org/uid/index.html sudo tail -f /var/log/suricata/fast.log
Send alerts to your SIEM
Suricata writes JSON events to eve.json. Ship that file to your SIEM (Wazuh agent or log shipper) to correlate alerts with server logs.
Tune
Disable rules for protocols you do not use and suppress known false positives, so the remaining alerts are worth investigating.
Commands are generic, industry-standard examples. Exact syntax and menu names vary by model and firmware; check your device's manual on the Documentation page.
Pro tips
- IDS only alerts; it does not block. Blocking (IPS mode) needs the sensor inline and careful testing.
- Check the sensor drops: high 'kernel_drops' in stats.log means the sensor is too small for the traffic.
FAQ
Frequently asked questions
Can Suricata see inside HTTPS?
Not the content, but it still sees TLS handshakes, certificates, domains (SNI), JA3/JA4 fingerprints and traffic patterns, which catch a lot of malware.
Keep learning
Related guides
Use port mirroring
Read more →Build a free SIEM with Wazuh
Read more →Capture traffic with Wireshark
Read more →How to Set Up a WireGuard VPN Server for Remote Access
WireGuard is a fast, modern VPN with a small, auditable code base. Build a WireGuard server on Linux, add users with their own keys and route them only to the networks they need.
Read more →How to Scan Your Network for Vulnerabilities With Nmap and OpenVAS
Find open ports, outdated services and known vulnerabilities before attackers do. Discover hosts with Nmap, then run authenticated vulnerability scans with Greenbone OpenVAS and fix what matters first.
Read more →How to Build a Free SIEM With Wazuh for Network and Server Logs
A SIEM collects logs from servers, firewalls and switches in one place and alerts on attacks. Install Wazuh, add agents and syslog sources, and tune the first alerts.
Read more →Stuck on a step?
Ask Navijin technical support or an authorised partner for help with your configuration.