Tag Archives: ethertool

Wake On LAN via Ubuntu Linux

Wake on LAN (WOL), works great, sometimes it is a bit tricky to configure. With Linux, the client that sends the magic packet requires etherwake and the unit to be waked requires ethtool to be installed. Ethtool configures the OS to actually boot on the Network Interface Card NIC’s command. The NIC has to support Wake on LAN and the BIOS has to be set up to use it.

Installing etherwake…

sudo aptitude install etherwake

Installing this package actually installs both etherwake and wakeonlan. To wake the computer….

wakeonlan MAC-Address-Here

or

etherwake MAC-Address-Here

MAC Address

MAC Address, aka Physical Address of a Linux machines NIC can be found by executing ifconfig. In Windows, you can use ipconfig /all.

 

Ethtool

Install…

sudo apt-get install ethtool

Use for eth0, enabling WOL…

sudo ethtool -s eth0 wol g

To check if the system is armed for WOL, run…

sudo ethtool eth0

Towards the bottom you should see

Supports wake on: g
Wake on : g

On my PC, I noticed that once it is waked. It is necessary to run…

sudo ethtool -s eth0 wol g

To re-arm the WOL, every time it is remote waked.

I will write a bash script to shutdown the server. It will execute…

sudo ethtool -s eth0 wol g
sudo shutdown -P now

Ensuring that when I power the server down remotely, it will be armed for WOL.

Better than that I found out by looking online while researching how to auto-suspend the server, this little piece…

Create “/etc/udev/rules.d/50-wol.rules” with the following contents:

ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*", RUN+="/usr/bin/ethtool -s %k wol g"

Check the syslog after creating it, errors will appear there if you spelled something wrong or whatnot.

tail /var/log/syslog

but as of now, no errors, but not setting wol g either. Still trouble shooting.

I found this piece at …

http://rolandtapken.de/blog/2013-07/suspend-nas-when-idle

The article talks about auto-suspending. But I found another article on auto-suspending that requires only a simple bash script that I have placed in /etc/cron.hourly but the article

https://bbs.archlinux.org/viewtopic.php?id=157268

does not give you the conf file, but it references another article in German

http://wiki.ubuntuusers.de/Skripte/AutoSuspend

that does have a conf file and it seems to work, at least it runs. I have yet to see if it actually will auto-suspend! I am working on it right now and will post an entire write up when the bugs are worked out.

 

Remote vs Local

The first try most likely be on your own LAN. To do it for real remotely requires setting up your router to forward ports. I had to set it to forward port 7 and 9 to the outside world. Then it is a matter of sending a magic packet to the ISP address that your router reports of a FQDN ( Fully Qualified Domain Name), remotely I had to have the bit mask set to 255.255.255.255 when using a utility on a website. Locally I noticed 0.0.0.0 ( broadcast ) worked.

 

I read a bit about WOL here before attempting to set it up.