Linux: Set up Wake on Lan - how it works
With Wake on Lan you can also wake up a computer over the network with Linux. In this practical tip, we show you how to test whether this feature works for your network card and how to use it.
Set up Wake on Lan under Linux - how it works
Unfortunately, not all network cards support Wake on Lan ("WOL"). You can see during the tutorial whether your card supports this feature. This is carried out as an example under Ubuntu 14.04:
- First make sure that WOL is activated in the BIOS of your PC and switch on the function if necessary.
- After you have activated the function, you must open the terminal and install the "ethtool" program. This works with the command "sudo apt-get install ethtool".
- You use the program to reactivate WOL in the operating system each time your computer starts up.
- Use the "sudo ethtool eth0" command to find out whether your network card supports WOL. The use of "eth0" is an example, change the name if you want to configure another interface.
- The point "Supports Wake-on" is particularly important in this context. The individual letters behind it stand for the modes with which your PC can be woken up.
- The letter "g" stands for example that your PC can be woken up with a so-called magic packet.
- You can now set exactly this mode by typing the command "sudo ethtool -s eth0 wol g". Then your PC is ready to be woken up by a Magic Packet.
- You can then wake up the PC with a tool such as Etherwake ("sudo apt-get install etherwake"). You can use it to send the named Magic Packet to your PC. You also need the Mac address of the target computer
- You can finally wake up the PC with the command "sudo etherwake 00: 00: 52: 23: 23: 9b", whereby you have to exchange this fictitious Mac address for that of the target computer.
Save WOL setting permanently - how it works
Unfortunately, you have to repeat this process after each restart. This is remedied by entries in some system files:
- Open the file "/etc/rc.local" with root rights and insert your start command from the first paragraph (see picture). In this way, the command is called automatically each time it is started.
- Unfortunately, Ubuntu turns off all network interfaces when shutting down. You can suppress this by opening the file "/etc/init.d/halt" with root rights and changing the line "NETDOWN = yes" to "NETDOWN = no".
- Now there is only one stumbling block left. WOL may not work after standby or suspend. To prevent this, open the file "/ etc / default / acpi-support" with root rights and change the line "STOP_SERVICES =" "to" STOP_SERVICES = "networking" ".
- After these changes, your computer should remain awake under all circumstances.
We'll also explain how to set up Wake on Lan on Windows.