This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

tcpdump doesn’t capture traffic

0

hi i,m new to tcpdump, i run it from linux terminal with this script but it only listens, it doesn't capture anything although it should, is there command like -k in wireshark , that makes tcpdump start capturing immediately ??

#!/bin/bash
tcpdump -i eth1 -s0 -c 700 -w ~/new.pcap "tcp"
sleep 3
iperf -c 192.168.1.2  &
sleep 6
killall tcpdump &
killall iperf

asked 17 Jun '15, 02:59

yas1234's gravatar image

yas1234
16182023
accept rate: 0%

converted to question 17 Jun '15, 03:32

grahamb's gravatar image

grahamb ♦
19.8k330206

Please don't tack new questions as an "Answer" to an existing unrelated question. Please read the FAQ for more info on using this site.

(17 Jun '15, 03:33) grahamb ♦

@yas1234: BTW, if I look at your question history, it seems like you don't fully understand how this site is supposed to work.

It's pretty simple:

  • You ask a question
  • people post their answers
  • if an answer is O.K. for you, you mark the answer as "accepted"

You have asked quite a few questions in the past, with good answers, but you never accepted one of those answers. Please read the FAQ of this site and make yourself familiar with the site rules.

https://ask.wireshark.org/faq/

Thanks!

(17 Jun '15, 04:24) Kurt Knochner ♦

One Answer:

0

You don't send the tcpdump command to the background (no & at the end of the command), and thus the other commands will be executed only after tcpdump was stopped (I guess after you pressed CTRL-C)!

is there command like -k in wireshark , that makes tcpdump start capturing immediately ??

No, tcpdump starts to capture traffic, as soon as you start it.

BTW: If you add the & to the tcpdump command, and you still don't see any traffic, you are either listening on the wrong interface (eth1) or the iperf command does not generate any traffic.

Regards
Kurt

answered 17 Jun '15, 04:21

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
24.8k1039237
accept rate: 15%

edited 17 Jun '15, 06:21