August 16 2015, 00:00#

Setup Wake On Lan on Debian 7

Wake On Lan (WOL) is a standard which allow to wake up remotely a sleeping machine by sending a magic packet.

WOL on the server side

Check the WOL support

Before all, it's necessary to ensure that your network controller supports the WOL and it is enabled in the BIOS. This part is not covered by this post.

The next step is to check on the OS level.

Install ethtool

As root user

aptitude install ethtool

Get the informations

As root user

ethtool eth0 | grep 'Wake-on:'

If the command does not return any result, consider that the WOL is not supported by your network controller.

In my case, I got a positive result:

Supports Wake-on: pg
Wake-on: d

The first line indicates what is supported on my network controller. The expected value is g for WOL.

The second line indicates what is activated. The d value seems tell that the WOL is disabled.

To be more clear, in my case WOL seems to be supported, but disabled. So, I need to enable it now.

Enable WOL

As root user

ethtool -s eth0 wol g

Checking

ethtool eth0 | grep 'Wake-on:'
  Supports Wake-on: pg
  Wake-on: g

WOL is now enabled on eth0 of my remote machine.

Get the MAC address

Before configuring the client, I need to get the MAC address of eth0.

As root user

ifconfig eth0 | grep 'HWaddr'
eth0      Link encap:Ethernet  HWaddr 0b:f1:a0:25:74:9b

WOL on the client side

How to wake up the remote machine?

Install wakeonlan

As root user

aptitude install wakeonlan

Send a magic packet

To wake up the remote machine, I send it a magic packet. To do it, I call the wakeonlan command and pass it the IP and MAC address of the remote machine.

As a normal user

wakeonlan -i 10.0.0.10 0b:f1:a0:25:74:9b

Be sure that the UDP port 9 is open on the remote machine.

Tags : unix linux debian network