Ubuntu tematic post:
Today i've enabled WOL on my server, to put it On remotely across internet (stop a PC is to type 'sudo halt' in a remote console, but to start it WOL is needed) -so it should stop being a public server an I could start it when I want to down/up load something in it via FTP or do whatever I've to do via ssh or VNC (yes, i'll put VNC too) -
Well... usually that's not a hard operation, you only have to enable the WOL in your server's BIOS -look in your motherboard's manual to see how to do it, changes between companies-, then tell your PC to ear to WOL. To do this, in ubuntu (to say your PC to wait for WOL signals) you must use ethtools. It's a program that isn't by default in ubuntu but is in repos, so you can instal it writing:
sudo apt-get install ethtools
Or using synaptic or apptitude or whatever you use. You have to run this command every time you start your computer:
sudo ethtool -s
To know whats your ethernet name type 'ifconfig' in a console (whitout the '), press enter and it will say somethin like this:
eth0 Link encap:Ethernet direcciónHW 00:12:34:56:78:90
Direc. inet:192.168.1.2 Difus.:192.168.1.255 Másc:255.255.255.0
Dirección in... (a lot of stuff more)
So, in my case the command will be:
sudo ethtool -s eth0 wol g
This way you say to ubuntu to change (-s) your eth connection (, in my case is eth0) to WOL (wol) on 'Magic packet' (it's easy to do it by sending a special created UDP packet).
But wait, typing that command on every reboot is annoying... better to automatize it...
To do this you must make a new text file with this text inside:
#!/bin/bash
ethtool -s eth0 wol g
exit
Save it. Copy it to /etc/init.d (you must be root, so do it graphically 'sudo nautilus' in console, to do in console go to file's directory and type 'sudo mv ./(filename) /etc/init.d/' without ' and changing (filename) with you file name)
Change file owner via file properties in nautilus or
sudo chown root:root (filename)
And make it executable via properties (giving it permissions of execution and read for all) or via console:
sudo chmod 755 (filename)
After this put it in your startup sequence:
sudo update-rc.d -f (filename) defaults 80
80 means 'at the end of secuence' (the end is in 99). Really, we haven't any hurry to run it when start, we only have to run it always...
This way the computer should be ready to WOL, now we only have to configure a client (android client in my case) and the router (I asume you have done it before to configure 'amule', we have to redirect one port, whatever you want, to the WOL port -9 by default- of your PC)
In client side you need only this info: your stopped PC's IP, and MAC address. To get your MAC, like previously, type 'ifconfig' and :
eth0 Link encap:Ethernet direcciónHW 00:12:34:56:78:90
Direc. inet:192.168.1.2 Difus.:192.168.1.255 Másc:255.255.255.0
In my case my MAC number is 00:12:34:56:78:90
At this point: I've had problem because my MAC changed on each reboot but I've solve it in a nice way :) It was an old 'solved' problem and it have a new solution. I have a post down here to explain how I've solve it.
I've use this application for android, pretty simple and clean, I like it (this is its page with instructions to WOL in windows), but they are applications for all operating systems (I promisse that I'll do one, it appears to be easy to do one and a good starting point to android and UDP programing).
Name is for you to identify the PC to wake up.
MAC: the mac address
IP or Domain: PC's IP or domain (your external IP or your DynDNS domain are valids)
Port: The port you hace redirected or the PC's port to WOL (default 9)
Giving this information to it the client should be working.
Good luck
PS: I've find the main info to do the WOL in ubuntuforums in this thread

No hay comentarios:
Publicar un comentario