Using tcpdump to check for network requests and sending wol magic packet.
Hey everyone,
I have been looking through the forum, but couldn't find a thread that would help me out. At least I didn't recognize it as such. I got a Fritzbox router running linux and busybox. My goal is to have a program running doing the following: Code:
IF "PC is running (ping?)" The thing is, that I am really new to this topic and the amount of information out there is just overwhelming. I was looking through a lot of threads, but I am getting more lost the more i read. So is this the right path? Can someone help me with the syntax? Or is there maybe a better solution to this? Thanks people tb2668 |
So you want to wake up your PC if any packet is sent to its IP address.
You can run tcpdump like this: Code:
tcpdump -i ethX -nn dst host 192.168.123.45 In parallel, a script based on ping that will start the above tcpdump if there is no reply, and kill it if there is a reply. I wonder if there isn't a better solution. For example snort, the intrusion detection system, can be configured so that it triggers an action when a certain network pattern is detected. But perhaps it's overkill for your task, and I don't know if it can be installed on the Fritzbox. A kind of much simplified snort would be ideal. |
Hey berndbausch,
thank you for your reply. Yes, I want my PC to wake up if contacted from outside, but only through specific ports. Lets say I want to access my data using FTP with my phone while I am not at home. Then the Fritzbox should detect that port 21 is being forwarded to my PC and send a magic packet, if the PC is in sleep mode. So here is my attempt so far: Code:
echo "Listening to port X for Host-IP X" >> /var/media/ftp/uStor01/checkport.log And how exactly would I save this in order for it to be a functioning shell command? Thanks |
All times are GMT -5. The time now is 01:33 AM. |