Ubuntu – Wake-on-LAN works with Windows 8 but not with Ubuntu

networkingshutdownwakeonlanwakeup

I have a PC that has a Windows 8 partition and an Ubuntu 13.04 partition. I am trying to get wake-on-lan to work. Everything works fine on the Windows 8 partition: I can wake-on-lan from both the sleep state and the shutdown state. However, when I shutdown Ubuntu using:

sudo shutdown -h now

I cannot wake the PC through my LAN. Is this because the network interface is getting turned off? What command can I use or how can I reconfigure Ubuntu so that wake-on-lan still works?

Also, if I do not use the -h option in the shutdown command, the PC does not actually shutdown; it just freezes up on me.

Using ethtool, I found that it says:

Supports Wake-on: pumbg
Wake-on: g
...
Link detected: yes

My etc/network/interfaces says this:

auto eth0
iface eth0 inet dhcp
      up ethtool -s eth0 wol g

EDIT: I have found that if I shut down the PC by simply holding the power button, then wol works. If I shutdown using the command line or through the Ubunutu GUI, then it does not work. So I think the issue is not that it is not being setup properly, but that something is overriding it or shutting it off when I shut down properly. Are there are any scripts that get run at shutdown?

I have added

NETDOWN=no

to both etc/default/halt and etc/init.d/halt

Best Answer

Your commands are close, but try this in command line:

sudo ethtool -s <NIC> wol g

or add this to your /etc/network/interfaces file:

auto eth0
iface eth0 inet dhcp
    up ethtool -s eth0 wol g

'g' enables wake via "Magic Packet"

Looks like if you are shutting down using the following command:

sudo shutdown -h now  

then you will also need to edit your /etc/default/halt file. Add the following line:

NETDOWN=no

and see if that works. That should prevent the -h (halt) from shutting down the network interfaces.

Related Question