Search code examples
linuxtcpdump

How to capture the packet from same machine with tcpdump on Linux?


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.


Solution

  • 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