I have a problem capturing wifi data using tcpdump
while running in the background.
OK, lets get some facts:
- my wifi-device is named
wlan0
wlan0
is in monitor mode (that's what I want)- I'm using
tcpdump
to capture packets
If I run my script manually in the shell, it works well. Now I want to capture all packets over a long period. I decided to put my script into /etc/rc.local
which is executed at the system-start.
It looks like this:
tcpdump -l -i wlan0 | do_some_action.sh >/dev/null 2>&1
After a reboot I can see that all the data captured is being forwarded to my script. So far - so good.
30-60 minutes later no data is captured anymore. tcpdump
is still running, but wlan0
seems to be gone sleeping.
I have to ifdown
/ ifup
wlan0
to get some traffic again.
Could anybody explain whats going on here and how to fix this problem?
/dev/null
. There might be some useful information in the error messages. Or maybe redirect the STDERR from thetcpdump
command.kernel: device wlan0 entered promiscuous mode