How to set up Wake On LAN on ubuntu home server
April 28, 2009 13 Comments
I am thinking about setting up a home server, which could be used as file, print, web and whatsoever server, I was playing around for some time with a NAS device. The problem was, that it didn’t really satisfy my needs. One reason was that it was too loud. Another reason was, that the hardware had not enough power to do the things I wanted.
I took some old hardware, which was much more powerful than the NAS device to try if that could eventually fullfill my requirements. But as that hardware consumes more energy and home servers are often idle most of the day (at least in my case), the first feature I want the box to be capable of, is to support Wake On LAN. So it would be possible for me to put the box somewhere where I don’t need to have physical access to and just start it when I really need it and shut it down afterwards. That would be better for the environment and for my wallet, too.
Here’s how I managed it:
- Check if the hardware supports WOL. If yes, enable it in the BIOS.
- Install ethtool. You can do this by entering
sudo apt-get install ethtoolin a konsole window.
- To check the settings, use the command ethtool {interface} where {interface} is the according interface. In my case the command is
sudo ethtool eth0and the output looks like this:
Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: pg Wake-on: d Current message level: 0x000000ff (255) Link detected: yesImportant here are the lines starting with Supports Wake-on and Wake-on. The first tells us, which Wake-On-LAN modes the network interface supports and the second if/which mode is enabled. The man page of ethtool says:
... wol p|u|m|b|a|g|s|d... Sets Wake-on-LAN options. Not all devices support this. The argument to this option is a string of characters specifying which options to enable. p Wake on phy activity u Wake on unicast messages m Wake on multicast messages b Wake on broadcast messages a Wake on ARP g Wake on MagicPacket(tm) s Enable SecureOn(tm) password for MagicPacket(tm) d Disable (wake on nothing). This option clears all previous options. ...My interface supports modes p and g but at the moment, it is disabled (Wake-on: d).
- Enable WOL using
sudo ethtool -s eth0 wol g. Now sudo ethtool eth0 shows Wake-on: g. - Test if it works. To do this, you need another computer with a tool which supports to send the MagicPacket(tm). You could e.g. install wakeonlan with a
sudo apt-get install wakeonlanon the computer which wants to wake the server. Additionally, you need the MAC address of your server’s network interface. You can get that with aifconfig eth0on your server. That will result in something like this:eth0 Link encap:Ethernet Hardware Adresse XX:XX:XX:XX:XX:XX inet6-Adresse: XXX::XXX:XXXX:XXXX:XXXX/64 Gültigkeitsbereich:Verbindung UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:14 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenlänge:1000 RX bytes:0 (0.0 B) TX bytes:3204 (3.2 KB) Interrupt:16To test, if it works, shutdown the server. Then try a
wakeonlan XX:XX:XX:XX:XX:XXwhere XX:XX:XX:XX:XX:XX is the address in line one of the output of ifconfig-command above. If it worked, the first step is done.
I don’t know, if it is necessary to do the following steps on every computer which wants to be woken up, but in my case, the setting of the ethtool command was not permanent(you could check this by a anew sudo ethtool eth0 or just try to wake a second time). If it is not permanent:
- add the line
ethtool -s eth0 wol gto the file /etc/rc.local.
- reboot
- try again if it works (for me it does)
Woah! I’m really enjoying the template/theme of this site.
It’s simple, yet effective. A lot of times it’s tough to get that “perfect balance” between usability
and visual appearance. I must say you have done a fantastic job with
this. Also, the blog loads extremely quick for me on Safari.
Exceptional Blog!
Pingback: Automated SCP Copy Script (with Wake-On-LAN) | Prasys' Blog
Pingback: Turn on Ubuntu web server remotely | Code Chewing
Pingback: Useful Website Articles & Tutorials | Code Chewing
I found some really good post about Wake On Lan oin ubuntu
http://lukasz-lademann.blogspot.com/2013/01/how-set-up-wol-wake-on-lan-on-thin.html
Reblogged this on Joaquín Huesca.
It was permanent for me without having to go through that last step. But I bookmarked this page. Thanks a lot!! 😀
Pingback: Using wake on lan to conserve power | Energy Monitor Blog
Pingback: Set up Wake On LAN on ubuntu home server | TurboLinux Blog
I did not know about the /etc/rc.local file. It is like a batch file that is put in the startup in Windoze. I was looking for a way to make WOL permanent on my Debian server. I think I just found it. Thanks!
Hi thanks for help any thing need help pls contact my mail
Works great on my system too. I like handling this in the rc.local file as well. Thanks for posting this solution.
Thanks. It works.