Wednesday, May 30, 2018

wakeonlan - remotely starting another computer

This is something I have been using for literally decades.  Since I have been setting this up in my home office, I am reminded that some people just may not have an idea this exists, and that they almost certainly have it on their computers.  Just a matter of turning it on.

I would have my "big" machine in a room away from where I was seated, then I'd wander off and sit on the couch with the little machine. Then I would need something on the big machine across the network. Since it was typically on my third floor it was impractical to take the laptop upstairs when the TV was on in the downstairs living room. To make it handy I wanted to turn that beast on so I could play music in the kitchen or read a document I have on it on my little machine. This little trick would let me do it.

"Wake On Lan" is simple conceptually. You send a "Magic Packet" to another computer on your network, or across the internet. The packet talks to the ethernet card, some wifi cards reportedly work but I have never figured that bit out. When the packet gets there, the computer turns itself on.

Think "Magic Bullet" to wake the computer sleeping at home while you are at work.

Mind you, there are steps to get this to work.:

You have to turn it on in your BIOS.
Ok, better said, you have to find out where it is in the pages of your BIOS, then turn it on.
If you have ever seen your BIOS, and know what's up in there, you probably are in a small minority of people, but trust me there are good things there.

You look for a prompt that says "Enable Wake On Lan" and make sure it says yes or is turned on or "selected", then save and reboot the computer.

That computer must be using a wired connection to the internet - an ethernet connection must be used and not Wifi, although I have seen that some people have managed to get this to work on Wifi.

Technically that's all you need on the "distant" computer you want to wake up, however you do need a few bits of information.

Every network card has a "MAC Address". Think of it as a telephone number. That network card, and only that network card has that specific number. I have mine, you have yours. Same thing as the phone number on your phone, or your IMEI number on the phone. You and only you have THAT number. It may also be in your BIOS, but every BIOS may vary.

You feed it into a wee little program and it fires off a magic packet to your network.

The packet wanders around your network and the ethernet card is listening. If that packet matches the address on the card, the card will wake up the computer from hibernation or turn it on with a "cold boot".

Then you can get your "stuff".

The business of across the internet is a bit more complex. You actually would have to punch a hole in your firewall for the purpose, and this is beyond this posting of "Hey look at this cool stuff".

RaspberryPi users, sorry, you can't wake a Pi across the network, and I really wish you could! The hardware is built more simply, and the Ethernet port actually sit on the USB Bus.

For Linux users (and BSD) with Debian XFCE, you can find out your MAC Address by looking at the connection information when you right click on the Network Connections icon in the status bar or in the Settings, Network Connections on the applications menu. Right click on the Wired Connection you have hooked up. Look for "Hardware Address:: and you will find a number that looks like 01:23:45:67:89:AB

Windows users, check your hardware manager under My Computer.

Mac, sorry, one isn't handy to me but the base commands should be there under your network manager.

Look for the Mac Address, again it's six pairs of Hex numerals that look like 01:23:45:67:89:ab, and write them down.

To test, hibernate or shut "this" distant computer down. Then go to the "other" computer, and launch a Wake On LAN Client. There are many, and they are generally free. Mine is called "wakeonlan" on Linux. It runs at a command line (gasp!) by typing (horrors!) in "wakeonlan 01:23:45:67:89:ab".  You can easily encapsulate it in a bash shell, of course.

Then after a short pause, the computer turns itself on and presents itself at a login prompt.

Your network shares will be available on that machine, or you can use Remote Desktop or VNC to use it directly from where you sit.

Wake on Lan clients are available:
Linux - called wakeonlan and is available by "apt install wakeonlan" in Debian.
Windows - there are a bunch of them that are available here.
Mac OSX - wakeonlan is available here.

No comments:

Post a Comment