I am moving my server and main development system out of a home office into rented office space. As I'm only going to be in the office two of three days a week, and being a hippy environmental type, I wanted to ensure my file server was not always switched on. Anything to reduce my carbon footprint a fraction.
WakeOnLan was the perfect solution I thought. I configured the server in the BIOS to start up on a Wake On LAN packet. With this I can turn on the server, and once the server is running I can use RDP (Remote Desktop Protocol) or VNC to remotely connect (I'll configure a proper VPN later). Once I finish using the server I can use RDP to turn off the server again.
It all worked on the local LAN, but getting it working remotely across the Internet was slightly more work. Thanks to Googling some excellent articles it only took around 90 minutes to figure it all out. The Linksys router was the main stumbling block in my setup.
Basically, WakeOnLan uses broadcast technology to send a 'magic packet' to all computers on the LAN. This packet contains the unique MAC address of the LAN card belonging to the PC you wish to turn on. Some forums/blogs suggest port forwarding or port triggering to a specific IP address but neither work on the WRT54G. As the server will not have an IP address if it is not switched on (as the O/S configures this) you cannot port forward in the usual manner. It is possible to port forward to ALL PCs. However, when using the default subnet of 255.255.255.0 the WRT54G does not allow port forwarding to the broadcast address, xxx.xxx.xxx.255. The web interface simply won't allow you to enter xxx.xxx.xxx.255 as a destination IP address.
Configuring the router
Fortunately I found this blog n01getsout.com which provided the solution. In the Linksys web configuration, you have to specify the subnet for the LAN DHCP pool as 255.255.255.128. You then configure the port forward (on any port, 5850 was one suggestion of a free port) to forward to xxx.xxx.xxx.127 which will forward the magic packet to all PCs on the network. The MAC address within the packet ensures that only that the specified PC turns on. Note: the WakeOnLan packet is not port specific so the destination port does not actually matter.
Wake On LAN utility (to send the magic packet)
The last step is to obtain a WakeOnLan utility to send the magic packet. If you're running Windows there is a great utility from depicus.com which does exactly what you need. You enter the MAC address of your PC (in a command window, ipconfig /all, it is listed as physical address), the public IP allocated by your ISP (I used whatismyipaddress.com for this), a subnet of 255.255.255.255, and the remote port number you configured in your router for port forwarding.
And that was it - now I can remotely switch on my server, do some work and then turn it off when I'm finished.
| posted on Wednesday, February 21, 2007 9:45 AM