Back to article
Linux Backup Server: Remote Wakeup, Automatic Shutdown
NIC and Motherboard Support
November 22, 2010
In part 3 of this series we learn how to use WOL, Wake-on-LAN, and the finer points of shutting a system down.
At last I can write this up for you, my fine readers. Today we're going to learn about using Wake-on-LAN to wake up a server remotely, and automatic shutdowns. My master plan for my backup server is to automate everything-- wake it up, run backups for all the computers in my house, and then everyone shuts down for the night. (You might want to review part 1 and part 2
The first requirement is your system BIOS must support WOL, and usually it is disabled by default, so you must enter your BIOS to turn it on.
Your Ethernet interface must support Wake-on-LAN (WOL). How do you find out? You need the ethool
# ethtool eth0 | grep -i wake-on
man ethtool explains all the switches. At a minimum you want to see this:
Supports Wake-on: g
g means "Wake on MagicPacket". If you see "Wake-on: d" then WOL is disabled. You can enable it with ethtool:
# ethtool -s eth0 wol g
This should survive the next restart so you can test it, and it might even survive several restarts.
You also need the MAC address of your NIC, which you find like this:
# ifconfig eth0 | grep -i hwaddr
Now power down the machine. Go to a PC on the same subnet and install wakeonlan. Then wake up your server like this:
$ wakeonlan -p 8 00:0A:CD:22:33:92
wakeonlan doesn't need root privileges. -p 8 tells it to send a magic packet to UDP port 8. The default is UDP port 9, which is a discard port for testing, a dead end, so it won't work. You should check your own /etc/services to find an unused port, and then edit it to note which one you are using for WOL.
There are variables that may get in your way, such as a motherboard or NIC that do not support WOL, or an older motherboard that requires a 3-pin Wake-on-LAN connector, even if you have a newer NIC. If your motherboard supports PCI 2.2 it should support PME (power management events), which means signals are sent through the PCI socket and you shouldn't need a 3-pin Wake-on-LAN connector. PCI 2.1 and older require the extra 3-pin connector, and a NIC that has a socket for the connector.
ATX power supplies are controlled via software, and your system is not truly turned off until you press the power switch on the back of the power supply. When you run a shutdown command or press the switch on the front of your computer case, the system goes into a standby mode. It still receives a little bit of power so WOL can work.