TCPDUMP


TCPdump is a powerful tool for network troubleshooting, packet analysis, and security auditing used by system administrators and network engineers. It allows users to capture and interpret packets that are transmitted or received over a network. With tcpdump, you can quickly identify the source of networking issues and pinpoint the cause of many problems.


  1. Listening to a Specific Interface: tcpdump -i <interface>
  2. Capturing Packets from Multiple Interfaces: tcpdump -D followed by -i for each interface
  3. Capturing Packets Based on Specified Protocols: tcpdump -nn <protocol>
  4. Capturing from a Specific Port: tcpdump port <portnumber>
  5. Capturing for a Specific Host: tcpdump host <IPaddress>
  6. Capturing All Traffic on the Network: tcpdump -p  
  7. Capturing Network Traffic for a Specific Duration: tcpdump -c <number of packets>
  8. Saving the Output to a File: tcpdump -w <filename>
  9. Reading Packets from a Log File: tcpdump -r <filename>  
  10. Applying a BPF Filter: tcpdump '<BPF filter>'
  11. Capturing Packets with or Without Promiscuous Mode: tcpdump -p or -P
  12. Capturing on Specific Network Layer and Protocols:  tcpdump -l <layer> <protocol>
  13. Capturing Packets with or Without Payload: tcpdump -s 0 or -s <length of payload to capture>
  14. Debugging Mode: tcpdump -ddd  
  15. List All Available Options: tcpdump --help  
  16. Displaying a Packet Summary: tcpdump -v  
  17. Suppressing Duplicate Packets: tcpdump -ddd -c <number of packets>
  18. Ignoring All Local Traffic: tcpdump -q
  19. Capturing IPv6 Traffic: tcpdump -n ip6
  20. Capturing on Specific Network Layer and Excluding a Protocol: tcpdump -l <layer> not <protocol>
  21. Dumping the Packet in Hex Format: tcpdump -xx
  22. Printing Timestamps for Each Captured Packet: tcpdump -tt
  23. Displaying the MTU for Each Captured Packet: tcpdump -m
  24. Troubleshoot TCP Connections:
    tcpdump -nSs 0 tcp port<portnumber> and '(src host <IPaddress> 
    and dst host<IPaddress>) or (src host <IPaddress> and dst host<IPaddress>)  
  25. Troubleshoot UDP Connections:
     tcpdump -nSs 0 udp port <portnumber> and '(src host <IPaddress> and dst host <IPaddress>) 
    or (src host <IPaddress> and dst host <IPaddress>)  
  26. Troubleshoot ICMP Connections:
     tcpdump -nSs 0 icmp and '(src host <IPaddress> and dst host <IPaddress>) 
    or (src host <IPaddress> and dst host <IPaddress>)  
  27. Troubleshoot Multicast Connections:
     tcpdump -nSs 0 multicast and'(src host <IPaddress> and dst host <IPaddress>) 
    or (src host <IPaddress> and dst host <IPaddress>)  
  28. Filtering Packets Containing a Specific String:
     tcpdump -s 0 -A '<string>'  
  29. Capturing on Specific Network Layer and Source/Destination Ports:
     tcpdump -l <layer> src port <portnumber> or dst port <portnumber>  
  30. Capturing All Traffic Except for a Specific Host: tcpdump not host <IPaddress>
  31. Exclude a Specific Protocol from Capturing: tcpdump not <protocol>
  32. Capturing Packets with Certain Flags: tcpdump 'flags <flagname>'
  33. Capturing Packets other them my ssh: tcpdump -i eth0 port not 22 and host <myIp>
  34. Capturing All Packets from all interface but not my IP: tcpdump host not <myIp>



By mastering the use of tcpdump, you can easily troubleshoot network issues and examine packets in detail. With its many capabilities, tcpdump is an invaluable tool for any network engineer or system administrator.

Happy packet capturing! :)

List of titles