My computer has only one network card. I have a program listening on one port. I intend to send one packet on the same machine, my program can receive the packet. I can't capture the packet by tcpdump on the machine which my program is running on.
If I send packet from another machine, tcpdump can capture the packet.
When we run the tcpdump command without any options, it will capture packets on the all interfaces, so to capture the packets from a specific interface use the option ‘ -i ‘ followed by the interface name. Syntax : # tcpdump -i {interface-name}. Let’s assume, i want to capture packets from interface “enp0s3”.
tcpdump is a packet sniffing and packet analyzing tool for a System Administrator to troubleshoot connectivity issues in Linux. It is used to capture, filter, and analyze network traffic such as TCP/IP packets going through your system.
tcpdump is a well known command line packet analyzer tool. Using tcpdump command we can capture the live TCP/IP packets and these packets can also be saved to a file.
sudo tcpdump This will capture the packets from the current interface of the network through which the system is connected to the internet. 2. To capture packets from a specific network interface
If i understand you correctly, you send the packet from a machine to itself. If so, you need tcpdump on the loopback interface. e.g.
tcpdump -i lo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With