Time-rotated capture files

Start a fresh pcap every hour with a timestamped name for unattended capture

tcpdump -nn -i any -G 3600 -w '/tmp/cap-%Y%m%d-%H%M%S.pcap'

tool
tcpdump18 commands
tags
tcpdumpmonitoringnetworkobservability

More tcpdump commands

  • tcpdump -nn -r /tmp/cap.pcap 'port 443 and host <ip>'

    Re-filter a saved capture without re-running it; BPF applies on read

  • tcpdump -nn -e -i any port 53

    Show DNS lookups with MAC addresses (-e) to map queries to clients on the LAN

  • tcpdump -i eth0 -n

    Capture all traffic on eth0 without DNS resolution

  • tcpdump -i eth0 -w /tmp/capture.pcap

    Save raw packets to PCAP file for Wireshark analysis

  • tcpdump -r /tmp/capture.pcap -n | head -50

    Replay and display packets from a saved PCAP file

all 18 tcpdump commands