121

I write a program that send TCP packets from localhost to localhost. And I want to use tcpdump to capture the packets. But nothing is captured. My command in Ubuntu:

sudo tcpdump

What argument shall I add? Thanks!

David
  • 1,235
  • 2
  • 8
  • 7

1 Answers1

217
sudo tcpdump -i lo

Notes

  • If you get tcpdump: lo: No such device exists, get the name by coping it from the output of
sudo tcpdump -D

For example, if the output is as below you need lo0 (which is reusult 9. here:

1.en0 [Up, Running]
2.p2p0 [Up, Running]
3.awdl0 [Up, Running]
4.llw0 [Up, Running]
5.utun0 [Up, Running]
6.utun1 [Up, Running]
7.utun2 [Up, Running]
8.utun3 [Up, Running]
9.lo0 [Up, Running, Loopback]
Sridhar Sarnobat
  • 25,183
  • 12
  • 93
  • 106
unbeli
  • 29,501
  • 5
  • 55
  • 57