Intro: Starting Your Linux Box Remotely.
There are just times when I can not get to a computer, but I still need to access it. So now when I install a machine, I set the machine to allow it to be started remotely. You can on some systems, password protect that process for security reasons. At home that is not a big deal most of the time.
Here we go:
Note: You can actually start any wol (make-on-lan) capable computer, not just a linux computer this way.
Step 1: Typical Situation.
You want to use your web server. Oh no, it's down. Maybe I can go in the back door and restart the server. Oops, that is down also. I must have shut the system down Now I have to get out of cozy bed to some cold or dark place to turn the system on. Ickky.
Oh, Wait I set up that server to turn on remotely!!! Just need to double click the icon to start it up.
Double clicked the icon and will wait a little bit.
Now let me see if I can log in remotely to check the status of the server
$ sudo /etc/init.d/apache2 status
[sudo] password for eddie:
Apache is running (pid 1602).
Oh great!! system is up and the web server is running. Let me get to the web page now. It's up! Done, all without leaving the bed. I will work on the Wordpress blog a bit.
How to do it next......
Step 2: Bios Setup.
Not all machines support remote startup or wakeup. The process is known as WOL or wake on lan. Of the ones that do, not all of them do it the same way, so read you computers tech manual for details about the bios. It usually is easy to do.
Once you have done that, you will want to start up the system and go to a command prompt and type: ifconfig
eth1 Link encap:Ethernet HWaddr 00:00:00:00:00:00 <================ HWaddr is the mac address.
inet addr:192.168.1.115 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:596593 errors:0 dropped:0 overruns:0 frame:0
TX packets:446564 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:757497076 (757.4 MB) TX bytes:50616341 (50.6 MB)
Interrupt:18 Base address:0xb000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:151 errors:0 dropped:0 overruns:0 frame:0
TX packets:151 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:32210 (32.2 KB) TX bytes:32210 (32.2 KB)
This will give you the Mac (media access control address). Nothing to do with Apple.
Save this address for later. I change the address I changed the one here for what ever reason,
Note: for mapping your network also see https://www.instructables.com/id/Map-your-network-visually/
Step 3: Get the Utilities.
This is for the computer where you want to manage other systems from:
Still at the command prompt:
sudo apt-get install wakeonlan etherwake.
You actually loading two utilities that do the same thing. I mention both utilities in case your system does not have one or the other.
Then you can create a batch file with the command and mac address so you do not have to remember it, I prefer wakeonlan.
# sudo etherwake -i eth1 -b 00:00:00:00:00:00
Enter the following command at the prompt from a remote machine to turn it on.
$ wakeonlan 00:00:00:00:00:00
$ chmod +x s1wake
Sending magic packet to 255.255.255.255:9 with 00:00:00:00:00:00
Note the remote machine to be awaken must have power to it, turned off and have a valid hard wired ethernet connection. I have not seen any wireless systems with this feature yet..
There are other utilities that will do the same thing for other systems, but I will not take the time to discuss them here..
Step 4: Logging In/out.
I do a lot of command line. In other words I can work on a machine remotely without using the mouse. This is known as working from the command line. I have created a lot of batch or command files to make the job easier. quicker and faster than using the mouse most of the time.
Once the machine is booted, you will want to log into that machine and do what needs to be done. Adding or removing software, doing updates, created and or modifying code such as for web pages, and whatever.
$ ssh servername
Once your done, you can type the following to remotely shut down the machine. (requires the sudo password),
$ sudo poweroff
I have done this with machine half way around the world. Can be a real life saver and you have done this without leaving your seat!
Step 5: Lets Make It Even Easier.
Remember that file you create called s1wake, well lets be able to use it from the desktop. So all you have to do to wake the server is double click on an icon to start the remote machine.
On the desktop, right click and choose "Create Launcher".
You should get a small window with some fill in the blank. Like the one show below.
Leave the type as application.
Name your application such as " Wake my server now!"
Now click on the browse button to locate the s1wake file you created earlier.
Click on open when you have found the file and highlighted it in the file browser.
You can add a comment if you want but that can be done later.
You should see a new icon on the desktop.
Double click on it and viola the remote machine starts.
Note: if you move or remove your s1wake file, the launcher will no longer work. Also you will still need to access the remote machine to shut it down.
Step 6: You Can Actually Do This With Most Any Computer.
If you search the web, you should find the program than will work on your system. Below are some examples. If you use DD-WRT on your router, that will do it. There is a web site that will help you do it and of course even native windows and make. Use your favorite search engine and search for WOL or "wake on lan".