In the previous post, we discussed how to access your server remotely from another machine (using VNC). However this did not go far enough for me (yes I am that lazy). In order to conserve energy (electrical, not my own in this case) I don't want my server to run 24/7 so I shut it down whenever I am not planning to use it. That bit I obviously can do remotely through VNC. However, every time I wanted to use the server I had to go to my garage and push the power button, too much work for me. So I started to wonder if there is a way to remotely wake up the server. And what do you know, there is, it is called Wake-on-LAN or WoL for short and it allows you to wake up your powered off computer using another computer connected to the same LAN, magic (literally, as you'll see in a moment). The caveat is that your computer and network card need to support this feature. This is usually advertised on the feature list of your NIC but if you aren't sure, you can verify this in Linux by issuing the following command in a terminal window:

$ sudo ethtool eth0

Don't worry to much about what this all means just yet, we will get to that in later posts, for now, just stick with me and you should see something like this in your terminal window:

The bit we are interested is the line that says "Supports Wake-on: umbg". If you cannot see this line at all, your card does not support wake on anything. If you do see this line, but not the exact same letters as I have (umbg) don't panic, the only letter you really need is g. This indicates your card supports Wake on Magicpacket (tm) (I told you!) which is what we are going to use to wake our server over the LAN.

Now that we have established that your NIC supports Wake on LAN, we need to enable it. You can see from the output that I have already done this (Wake-on: g), you can do the same by issuing the following command:

$ sudo ethtool -s eth0 wol g

That should set the Wake-on line to g. You can verify this by rerunning the command

$ sudo ethtool eth0

That covers the server part. Now you need to get a piece of software that can generate a MagicPacket and send it to your server. I am using something called WOL Magic Packet Sender for my windows machine (I haven't moved completely to Linux :-) which is free and you can get from but you can use any one. On Linux you can use the wakeonlan command. Before you shut down your server you first need to write down its IP address and the MAC address of the NIC, both of these can be found on the Connection Information window which I explained how to open in the previous post. Now you are ready for some magic.

Shut down your server by issuig the following command:

$ sudo shutdown -h now

This will obviously kill your VNC session but we will bring it back up when the server starts up, more on that later. Open up your favorite MagicPacket generator and try to send one to your server (use IP address and MAC address obtained earlier). Your server should roar back to live.

This leaves us with one more issue to tackle, when you wake up your server it will halt at the login screen, waiting for someone to provide a user and password. At this point in time, the VNC server has NOT yet been started so you cannot connect remotely to the server to do this. You have to enter the required information on the server itself meaning a trip to the garage/basement, not what I wanted. Luckily in Linux there is a feature that allows you to login users automatically. Go to System -> Administration -> Login Window, go to the Security tab and check "Enable Automatic Login" and pick a user:

The next time your computer boots up it will go straight into Ubuntu desktop (as the user you selected), whether you boot manually or use WoL. So please give it another go now, shutdown the server and send a MagicPacket from another PC. After a minute or so you should be able to start VNC again and log back into your server. Now I finally have what I wanted, full remote control of my server, including power on and off, from anywhere in the house.

So much for the instructions. Now here's the bad news, I build my server from scratch, component by component and then installed Ubuntu on it in about an hour. Getting WoL to work took me more than 2 weeks, and it still does not work the way I want to. It should work for most of you with the above instructions, but if it does not, let me know and I'll get you the lowdown on what you should check and configure in Ubuntu to get it to work properly.