Idea – Reduce Noise, Save on Electricity
My electric company installed an electricity consumption gadget, and ability to monitor usage online. A few month into the experiment I realized, that I can easily reduce electric usage, if I turned off my server. It is been over a year since I migrated all my sites to Amazon cloud, so now my server only needs to be on, when I need it on. All the nights and 90% of all work hours it can be off. But how to do that?
I recall seeing something in BIOSes of Intel motherboards called Wake-On-LAN. First time I saw something like this was in May of 2007. I remember I just bought all the parts for a new server, and I was configuring this new Intel motherboard. And then I saw that option on all later models.
Now, 4 year later, let me check, what is this feature for. May be I can keep my server down most of the time, and only turn it on upon my remote request? Is it possible? If it is, it would mean running a 500W power supply only several hours a week, instead 168 hours each week.
Very Easy to Start
First discovery was that it is very easy to do a remote start. Just download a command line utility from (high marks!)
http://www.depicus.com/wake-on-lan/wake-on-lan-cmd.aspx
and create a one line CMD file for each workstation that you plan to wake up (see example later).
Do not bother with graphical utilities. True permanent solution includes creation of a shortcut to a batch file that you can execute with one click, without entering any values or parameters.
A Little Secret that Clicked
All the hardware configuration and software configuration on a workstation already covered many times on the Internet. What is the salt of the matter is an IP address that you use on your router to transmit a wake up packet onto your local network.
Here is the moment of truth. Get ready. On you router forward UDP requests from a port of your choosing to a 255 IP address of your LAN sun-network. For example, if you router is sitting on 192,168.0.1, you should enter 192,168.0.255.
That is it. That is a secret. Every other steps you can find on the Internet somewhere.
To create your Wake up batch file use this well-documented syntax:
PATH\YourUtility 1MAC 2IP 3MASK [4PORT]
where
Parameter | Description |
---|---|
YourUtility | Name of your Wake-On-LAN tool (Example: WolCmd) |
1MAC | Machine network card unique MAC address, without columns (:), but with leading zeros (00NNNNN…) |
2IP | Your router external IP address. Here is the most important point: your machine IP address is irrelevant – your machine is OFF. |
3MASK | Always 255.255.255.255 |
4PORT | Any port you decide to open for UDP traffic on your router (Example: 8079) |
Example:
%AppData%\WOL\WolCmd 0091A41BC6C0 NNN.NNN.NNN.NNN 255.255.255.255 8079
Here is a recommendation for picking the port. It is only logical to pick a port previous to your RDP port. Say, you already open port 8080 to run TCP traffic for your RDP sessions. In that case open 8079 for UDP traffic to do your waking up.
Please let me know, if any router allows utilizing just one port for both wake up and RDP. It will be cleaner and more secure.
Additional Notes
This works for both powering up and waking from Sleep or Hibernate.
Only one port is needed to wake up any wired workstations on your network.
This technique doesn’t work to wake up Wi-Fi machines.
If Wake-Up doesn’t work from one of your PC(s), examine protection settings. In one instance, I’ve notice that a rule was created in McAfee SaaS Endpoint Protection 5.2.0 to specifically block application WolCmd.exe. You have to “Allow” this application to run.
It is important to understand that with machine shutdown, your scheduled scripts are no longer running. You have to take extra steps to perform backups, data synchronizations, Windows updates and similar.
Shutdown Considerations
To shutdown your remote machine your should use RDP:
On XP or Win7 you can use Ctrl+Alt+End. That will send a Ctrl+Alt+Del to your remote machine. From there you can access Shutdown option.
On Windows 2003 and 2008 Servers use Start –> Shutdown.
To shutdown your local machine (on your LAN) you can use this command in XP:
ShutDown -s -m \\MACHINE_NAME
This command does exist on Win7, and 2008 Server and R2.
Windows 2008 Server R2 will not respond to a shutdown command from an XP machine. I would look into this for more details (http://technet.microsoft.com/en-us/library/cc732503(WS.10).aspx)
Be the first to comment