Wake On Lan with Ubuntu

        

Wake-on-lan is incredibly useful for those scenarios where you have more than one machine on a network, but you don’t always want to have them running but they are needed sometimes.

To setup, make sure that the Motherboard and NIC support is there from your manufacturer. Sometimes it has to be enabled, such as making sure that it uses S3 for shutdown, and that PCI wake is supported.

Next you need to check support from the operating system, I am using Ubuntu 10.04, but this should work for other operating systems. Install ethtool, and then check against the ethernet adapter (eth0 in my example).

[cc lang=“bash”]

sudo apt-get install ethtool

sudo ethtool eth0

[/cc]

If support is enabled, but it is turned off you will see:

[cc lang=“bash”]

Supports Wake-on: g

Wake-on: d

[/cc]

So we turn it on:

[cc lang=“bash”]

sudo ethtool -s eth0 wol g

[/cc]

Now we need to make sure that its always enabled everytime we restart:

[cc lang=“bash”]

cd /etc/init.d/

sudo vim wakeonlan

[/cc]

And in that file:

[cc lang=“bash”]

#!/bin/bash

ethtool -s eth0 wol g

exit

[/cc]

Now make sure that its put into the correct runlevels:

[cc lang=“bash”]

sudo chmod a+x wakeonlan

sudo update-rc.d -f wakeonlan defaults

[/cc]

And that is it. It should be supported that you can wake the machine from another computer/server using your favourite wakeup utility ( such as wakeonlan ).

comments powered by Disqus