Tcpdump is a powerful command-line packet analyzer used to capture and analyze network traffic. It allows users to filter and display specific packets based on various criteria such as IP addresses, ports, and protocols. This tool is essential for network troubleshooting, security analysis, and monitoring network activities.
To start using tcpdump, you must have root privileges. The basic syntax of tcpdump is as follows:
tcpdump [options] [filter]
Where:
For instance, to capture packets on the default network interface, you can run the following command:
sudo tcpdump -i eth0
This command captures all packets on the eth0 interface.
You can also filter packets by IP address. For example, to capture only the traffic to and from a specific IP address, you can use:
sudo tcpdump -i eth0 host 192.168.1.1
This command will display all packets that are sent to or received from the IP address 192.168.1.1.
Tcpdump can also save captured packets to a file for later analysis. You can use the -w option to do this:
sudo tcpdump -i eth0 -w output.pcap
This will save the captured packets to a file named output.pcap.
How do I avoid rehashing overhead with std::set in multithreaded code?
How do I find elements with custom comparators with std::set for embedded targets?
How do I erase elements while iterating with std::set for embedded targets?
How do I provide stable iteration order with std::unordered_map for large datasets?
How do I reserve capacity ahead of time with std::unordered_map for large datasets?
How do I erase elements while iterating with std::unordered_map in multithreaded code?
How do I provide stable iteration order with std::map for embedded targets?
How do I provide stable iteration order with std::map in multithreaded code?
How do I avoid rehashing overhead with std::map in performance-sensitive code?
How do I merge two containers efficiently with std::map for embedded targets?