[CLUE-Tech] Wakeon LAN shell script

Dave Anselmi anselmi at americanisp.net
Fri Mar 1 12:24:31 MST 2002


Kevin Cullis wrote:

> Hi all,
>
> Will Stevenson, from OMI, talked about this wakeon LAN shell script
> during the installfest and he passed it on to me to give to you all.
> Here it is:

Well, I played with some things and I think that the script does not work.
I had two problems trying to use it.

First, how to convert the wake-up string from the ascii in the script to
binary.  There are ways to go from binary to ascii, but I don't see any the
other way.  It's trivial in C, an probably perl, too, but I don't know how
in shell.  I can make a file with binary characters in vi (well, on
Linux--not on OpenBSD or cygwin).  Since the characters sent are binary,
I'm not sure how telnet would handle them, but netcat works ok.

Second, the wake-up packet has to go to the right card.  Netcat and most
programs use IP addresses and the arp entries that map to MAC address are
done automagically.  But if the target machine is off, it doesn't have an
IP to answer the arp request for.  So I did it by hand:

arp -s <IP address> <MAC address like 00:02:be:aa:bb:cc>

It doesn't matter what IP you use, as long as it matches the one you use
for the netcat command.  It's probably a good idea not to use one already
in use.

It occurs to me that you could certainly send a wake-up through a router,
so you don't have to be on the same lan segment.  This could be done
through firewalls, typically, and maybe even through NAT in some cases.
You could also probably build a scanner to find wakeable machines.
Probably need to restrict the ethernet address space to be usable, though.

Dave





More information about the clue-tech mailing list