Labels

[wol] Wake on Lan

wakeonlan client

On the computer you will use to send the WOL packet, you need to have a client to generate this kind of data. You may use net-misc/wakeonlan Perl script as client, which is in Portage tree:

emerge -n net-misc/wakeonlan

Prepare and wake up your PC

You need to know the MAC address of the PC you want to wake up; you may get this information from the client PC using ping towards the PC you want to wake up (in this example 192.168.20.52) and then you can see the arp table:

ping 192.168.20.52 arp

You will have an output similar to this, from which you'll get the MAC address:

Code:
Address                  HWtype  HWaddress           Flags Mask            Iface jupiter.home.net         ether   00:0C:6E:96:58:DE   C                     eth0 

Now, you may switch off the computer on which you want to try WOL. From the client PC, you have to send the WOL packet:

wakeonlan -i 192.168.20.255 00:0C:6E:96:58:DE

In this example, we send the WOL packet in broadcast to the subnet 192.168.20.x, using the MAC address we got before. Now, if everything is ok, you see your computer wake up magically!

WOL always enabled on shutdown

You may experience that, on next reboot of system, your PC won't wake up, even if you send WOL packet correctly from another box; this is due to the fact that the ethernet driver will lose it's previous configuration during boot.

A quick and clean way to get rid of this, and let the wake on LAN be enabled on every shut-down, is to add this line to /etc/conf.d/local.stop

Code: /etc/conf.d/local.stop
ethtool -s eth1 wol g

This is the same command used to enable WOL previously used from shell; when your Gentoo box turns off, the commands presents in this configuration file are executed, so you'll have WOL enabled at every shut-down.