Saturday, September 1, 2018

Ubuntu WOL not working anymore after apt-get upgrade

I got a problem on my server that it could not be woken up after I did apt-get upgadre and apt-get dist-upgrade to my system.

Quick googling the problem, I found that doing this would solve the problem. The reference was https://help.ubuntu.com/community/WakeOnLan

Enabling WoL in the NIC

Determining whether the NIC supports WoL

First, determine which NIC will be used, and then check whether it supports the Magic Packet™ using
sudo ethtool 
where is the device name of your NIC, e.g. eth0. This command will output some information about your the capabilities of your NIC. If this output contains a line similar to the following:
Supports Wake-on: 
where  contains the letter g, the NIC should support the WoL Magic Packet™ method (for the other letters look at man ethtool).

Enabling WoL in the NIC

To check whether WoL is enabled in the NIC, one could use
sudo ethtool 
and look for
Wake-on: 
If  contains g and not d, then Magic Packet™ is enabled. However, if  does contain d, WoL needs to be enabled by running the following command:
sudo ethtool -s  wol g
On most systems, issuing this command is required after each boot. If the system's networking is configured via ifupdown, then it is easy to add the line up ethtool -s  wol g below the interface's configuration stanza in /etc/network/interfaces. For example:
shahar@shahar-backup:~$ cat /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface

auto lo
iface lo inet loopback
# The primary network interface

auto eth0
iface eth0 inet static
        address 10.0.0.1
        netmask 255.255.255.0
        gateway 10.0.0.138
        up ethtool -s eth0 wol g

This will ensure that WoL is enabled in the NIC on each boot. Fore more information see the interfaces manual.

However, my network setting was done using Network Manager. I did not dare to follow edit of /etc/network/interfaces since I was afraid it would ruin the network setting. Another googling found this, https://apuntesderootblog.wordpress.com/2015/12/02/enable-wake-on-lan-with-networkmanager/

Enable wake-on-lan with NetworkManager

This little tip enables wake-on-lan on our network interfaces so the computer can be awaken with a magic packet from other host in the same network.
First, identify your connection:
# nmcli connection 
NOMBRE      UUID                                  TIPO            DISPOSITIVO 
virbr0      3ee5c0b6-1030-4609-b087-4ab3d39ccdfa  bridge          virbr0      
br-lan      e7b20dc3-9d8e-4b0e-b56f-27a87f17ebe3  bridge          br-lan      
enp5s0      8581aa55-eead-41d6-a216-41f52b4e0c30  802-3-ethernet  enp5s0      
virbr0-nic  04cc0eff-0b0d-4440-9e7b-1c54418e8ef7  generic         virbr0-ni
Then, activate the wake-on-lan functionality:
# nmcli connection modify enp5s0 802-3-ethernet.wake-on-lan magic
Your BIOS has to support and had enabled waking up from your network card.

Thank you so much for both who provide those references. It as useful for me and I hope also for you.

No comments: