LinuxCommandLibrary

snort

Network intrusion detection and prevention system

TLDR

Sniffer mode

$ snort -v -i [eth0]
copy
Packet logger
$ snort -dev -l [/var/log/snort] -i [eth0]
copy
IDS mode
$ snort -c [/etc/snort/snort.conf] -i [eth0]
copy
Test configuration
$ snort -T -c [/etc/snort/snort.conf]
copy
Read pcap file
$ snort -r [capture.pcap] -c [snort.conf]
copy
Daemon mode
$ snort -D -c [snort.conf] -i [eth0]
copy
Alert modes
$ snort -A [fast] -c [snort.conf] -i [eth0]
copy

SYNOPSIS

snort [-c config] [-l logdir] [-i interface] [options]

DESCRIPTION

snort is an open-source network intrusion detection and prevention system (IDS/IPS) that performs real-time traffic analysis and packet logging. It examines network traffic against a set of user-defined rules to detect attacks, probes, and suspicious activity.
The tool operates in three modes: sniffer mode displays packets on the console, logger mode records traffic to pcap files for offline analysis, and IDS mode applies detection rules and generates alerts. Rules use a flexible language that matches on protocol, content patterns, flow direction, and other packet characteristics.
Snort can operate inline as an IPS to actively block detected threats, or passively as an IDS that only monitors and alerts. Its rule format has become an industry standard, with thousands of community and commercial rules available for detecting known vulnerabilities, malware, and policy violations.

PARAMETERS

-c FILE

Configuration file.
-i INTERFACE
Network interface.
-l DIR
Log directory.
-A MODE
Alert mode (fast, full, console).
-D
Daemon mode.
-r FILE
Read pcap.
-T
Test configuration.
-v
Verbose.
-d
Dump packet data.
-e
Display link layer.

CONFIGURATION

/etc/snort/snort.conf

Main configuration file defining network variables, preprocessors, output plugins, and rule paths.
/etc/snort/rules/
Directory containing detection rule files loaded by the configuration.

CAVEATS

Requires root for capture. Rule tuning needed. High bandwidth challenging.

HISTORY

Snort was created by Martin Roesch in 1998. It became the most widely deployed IDS, now maintained by Cisco.

SEE ALSO

suricata(1), tcpdump(1), zeek(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community