Capture packets on eth0, rotating files, excluding SSH traffic
Capture packets on eth0, rotating files, excluding SSH traffic
Tcpdump / Network Monitoring
Command
tcpdump -i eth0 -w /tmp/capture.pcap -C 100 -W 10 port not 22
Syntax
tcpdump -i <interface> -w <file> [filters]
Use case
Long-running network capture during incident response or threat hunting to capture suspicious traffic without filling disk or mixing with analyst SSH sessions.
Explanation
Professional packet capture setup: • -i eth0 → Listen on eth0 interface • -w → Write raw packets to pcap file • -C 100 → Rotate file every 100MB • -W 10 → Keep max 10 rotated files (ring buffer) • port not 22 → Exclude SSH to reduce noise Open captures in Wireshark for analysis. Use -r capture.pcap to read and filter saved captures.
Example output
tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
Rotating output to /tmp/capture1.pcap
Rotating output to /tmp/capture2.pcap
More examples
Primary example
tcpdump -i eth0 -w /tmp/capture.pcap -C 100 -W 10 port not 22
Long-running network capture during incident response or threat hunting to capture suspicious traffic without filling disk or mixing with analyst SSH sessions.
Related
Process a packet capture with Zeek local policy.
Process a packet capture with Zeek local policy.
zeek -r sample.pcap local
Summarize network services from Zeek connection logs.
Summarize network services from Zeek connection logs.
zeek-cut id.orig_h id.resp_h service < conn.log | sort | uniq -c
Inspect DNS queries and answers.
Inspect DNS queries and answers.
zeek-cut query answers < dns.log | head