Arp2wol, small hack to send wake on lan frames based on arp requests.
-
it works fine if i run it from the shell directly, it loops only when i run it on boot using shell comand or *sh file under /usr/local/etc/rc.d.
The $$ should have a different value(PID) every time you start the script, no? not sure this will work properly with scripts running in the background.
-
The $$ should have a different value(PID) every time you start the script, no? not sure this will work properly with scripts running in the background.
No $$ returns the pid of the current shell.
If you fork multiple instance of the arp2wol.sh then all of them will have the same parent (the init script which executes it).
–> All of them will use the same pid-file. -
thank you let me test jot.
-
Many thanks for this script :D
Does this log the source of the arp request?
-
Not really, but you can easily extend it to do this.
$data contains the line which triggered the event.
–> the arp responses look something like13:22:24.457157 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 80.219.3.42 tell 80.219.2.1, length 46
-
Can this script to be modified to work across subnets ie the device I want to wake up in this instance is on a different subnet to everything that is waking it connected to lan interface em2, those devices waking it are connected to lan em1?
-
I don't know, but this really has nothing to do with this script.
This script exists to trigger something based on ARP lookups.
What you trigger is your own thing.Try reading the documentation of the /usr/local/bin/wol which is used on pfsense to send magic packet.
-
I am not 100% sure but I think all I need to do is remove "arp" from the tcpdump command and ensure $TARGET_BROADCAST $TARGET_MAC are those of the machine to be woken and $INTERFACE is the lan on the source machines trying to access the target?
-
A client trying access a server on a different network segment (subnet) will never issue an ARP broadcast for the destination address because MAC addresses are local to the connected segment and access to the outside of the local segment is done via a gateway (the router in between the segments). In other words, the MAC address of the destination host won't show up in the traffic of the client's network. You have to monitor the destination IP instead and then trigger the WOL action on the other network segment where the to be woken up hosts are.
-
Yep, removing the arp and it works great, I am actually doing it via port , thanks again for the script.
-
If you want to change what the tcpdump is looking for:
Here is some documentation to that: http://www.tcpdump.org/manpages/pcap-filter.7.html -
I am using the original script posted by @GruensFroeschli with shellcmd. The cpu usage jumps to 100% when I use shellcmd through gui. When I run it as a sh script in ssh, it runs fine and cpu usage stays at 5% but need to login each time after reboot to do that. I am a newbie. Any help is greatly appreciated. I am running 2.4.2-RELEASE-p1 (amd64). Thanks !
-
Anyone have any suggestions .. TIA