3

I have a DNS server and I want to capture DNS traffic to get all the IPs which use my DNS server.

For this I start using following tcpdump command and capture them to a file:

tcpdump -n -i eth0 dst port 53 >> dns_data.log

But the file size is high when I run this for long time. How can I capture this to a compress file? I tried below command but its not working.

tcpdump -n -i eth0 dst port 53 | bzip2 -c >> dns_data.bz2
Yasiru G
  • 6,886
  • 6
  • 23
  • 43

1 Answers1

5

Try something like tcpdump -G 3600 -w 'trace_%Y-%m-%d_%H:%M:%S.pcap' -z gzip

-G N means rotate every N (3600) seconds. -z command means run command(gzip) after rotation.

Community
  • 1
  • 1
Anatoliy Orlov
  • 469
  • 2
  • 5