WakeOnLan, tcp packet

I'd like to use SPARC Solaris10 to 'wake up' an old PC on same LAN.
what is the simplest way of doing it? (preferably without installing new software)

thanks.

http://pkgs.fedoraproject.org/repo/pkgs/wol/wol-0.7.1.tar.gz/c2fa9d7e771134ac8c89d56b8197d4ca/wol-0.7.1.tar.gz

1 Like

Firstly the PC (BIOS) motherboard must support wake on lan.

Once enable in the BIOS it should be fairly simple.

You send the sleeping system (or even powered down system if it has volts supplied) a magic packet. The magic packet can come from anywhere. I've sent a magic packet to my system at home from the office by using NAT and port forwarding on my router at home.

There are a number of magic packet generators available for download free on the internet. Obviously you need to select one that works on your O/S.
Just Google something like "magic packet generator".

Does that help? Or am I telling you stuff that you already know?

thanks. I've managed to wake it from Linux with 'etherwake'. On Solaris, I'd like to use 'telnet' or similar, to avoid installing anything. is this possible?

You can't telnet to a machine that's asleep. Incidental traffic to a "wrong" machine won't work either, a modern switched network won't repeat it to anything else. Only broadcasts go to everyone.

So it pretty much has to be a connectionless broadcast -- UDP or ICMP. But ping won't let you shoehorn in the magic sequence, so that's out.

How about a perl script?

http://gsd.di.uminho.pt/jpo/software/wakeonlan/

1 Like

thanks, I'll try perl. I've seen (on some forum), people use this on linux (for different purpose):

could something similar be used?

To repeat:

1) You can't make TCP connections to a machine that's asleep.

2) You can't even aim at a machine that's asleep -- by definition, it doesn't have an IP yet.

Things like telnet, ftp, etc mostly use TCP connections, which depend on the machine being awake to respond. UDP is more like ping, where it just gets sent no matter what.

But it takes a very specific kind of UDP packet to reach a sleeping machine: A broadcast UDP packet. It has to be a broadcast because, without an IP, you have no way to "aim" the packet at anyone. I don't think writing to the broadcast address is enough these days, it has to be sent with the special BROADCAST flag. So that rules out /dev/udp tricks as well. Lots of shells don't even have /dev/udp -- despite the name, there is no /dev/udp, that's a shell extension in a few specific versions of KSH and BASH.

Furthermore, a magic packet is going to be difficult to craft in a shell. Shells aren't equipped to deal with binary data. You'd have to worry about which version of what shell everyone has to have any hope -- it wouldn't be portable.

Too bad there's not a well-known scripting language which supports networking, binary strings, and is installed everywhere you go -- like perl...

If you don't manually enter the magic packet into /dev/udp each time you want to wake up a machine, you're going to have to install something - whether that's a script your wrote or something somebody else wrote.

Even then, some machines that purport to support wake-on-lan are pretty crappy about it. You probably won't have any problems from enterprise-grade vendors like IBM, Sun/Oracle, or HP, but anything under that level could be problematic. I have a supposedly enterprise-grade Supermicro server that will only wake-on-lan after the OS boots and sets the proper flags in the ethernet interfaces. I can then shut it down and restart it with a magic packet. But if that server ever loses power the only way to restart it is to physically press the power button.

1 Like

You are all, of course, correct in saying that there is no ip address to aim at if the machine is dead.

A magic packet generator (MPG) takes a MAC address as input and this is why the target machine must have BIOS support for wake-on-lan. The BIOS has the network adapter powered, even though the machine is off, to listen for a magic packet carrying that machines MAC address. If that is received, the machine powers up.

Although you don't want to install software most magic packet generators are a single executable, many of which will take the target MAC address as a command line argument.

I haven't looked for a Solaris MPG. First question is are we talking SPARC or X86?

---------- Post updated at 07:47 PM ---------- Previous update was at 07:27 PM ----------

Sorry, I am an idiot. You've already said that it's SPARC.

1 Like

ATM, not sure if perl is installed, and whether it has: 'use Socket; use Getopt::Std;'
I don't need portable solution. Its just for one specific PC and SPARC. packet can be 'crafted' on Linux.

If you have perl, the problem is solved. Perhaps you could be convinced to check?

I understand your fear of perl requirement madness, but those modules are all standard Perl, nothing weird.

1 Like

If you looked, that source tarball I posted the link to is for a Fedora package.

You might want to try something like "yum install wol"....

(sorry for the delay, been busy)

I've tried that perl script 'wakeonlan' and it works beautifully on Debian (even without sudo). however, on Solaris it doesn't:

Use of uninitialized value in subroutine entry at /export/home/user/bin/wakeonlan line 72. 
Bad arg length for Socket::pack_sockaddr_in, length is 0, should be 4 at /export/home/user/bin/wakeonlan line 72. 

have to admit, I didn't use 'make' on either OS. simply started script.
the perl we got on Solaris is rather old, though.

@achenle
can that Fedora package be 'crosscompiled' for SPARC Solaris on Debian?

at this point, I'd rather use perl.
been using it regularly for other stuff on Debian anyway, and like it.

I found this...........

I don't know whether it's any use to you but it does say "Sparc binary" and has Perl listed as dependency.

I can't take this further as I'm not a Perl person.

And this.....

Sophie: wol-0:0.7.1-1 sparc

1 Like

it seems the problem in perl script was in 'gethostbyname' function. maybe its IPv6 vs IPv4 thing.
anyway, I think I've solved it by adding:

$raddr = "\xff\xff\xff\xff";

right below it. so its broadcast only now, but no more errors.

1 Like