2. Back in ubuntu, kubuntu, xubuntu, w/e, we now need to make a script that will run every time the computer is started, because this command only lasts until the computer is turned on again once.
2a. Find out what network device you want to have the computer wake-able from, usually all, which is just one. If you have more network devices in your system, 9 chances out of 10, you already know what they are called.
You can NOT wake up a laptop or computer that is only connected via wireless with wake-on-lan, unless the bios has a method for this, this is very rare, and I do not garuntee this howto will work in such cases.
In your terminal, type:
ifconfig
So, I want this system to be wake-able from eth0.
2b. Now we create the script.
Change to the startup script directory and start editing a new file:
sudo -i
apt-get install ethtool
cd /etc/init.d/
nano wakeonlanconfig
Paste, or type this into the file, replacing eth0 with your network device, repeat the ethtool line as many times for your devices before the exit line:
#!/bin/bash
ethtool -s eth0 wol g
exit
Set the permissions of the file and make the script run on startup:
chmod a+x wakeonlanconfig
update-rc.d -f wakeonlanconfig defaults
You should see something like:
Adding system startup for /etc/init.d/wakeonlanconfig ...
/etc/rc0.d/K20wakeonlanconfig -> ../init.d/wakeonlanconfig
/etc/rc1.d/K20wakeonlanconfig -> ../init.d/wakeonlanconfig
/etc/rc6.d/K20wakeonlanconfig -> ../init.d/wakeonlanconfig
/etc/rc2.d/S20wakeonlanconfig -> ../init.d/wakeonlanconfig
/etc/rc3.d/S20wakeonlanconfig -> ../init.d/wakeonlanconfig
/etc/rc4.d/S20wakeonlanconfig -> ../init.d/wakeonlanconfig
/etc/rc5.d/S20wakeonlanconfig -> ../init.d/wakeonlanconfig
Now we finish by running it, and making sure there are no errors.
sh /etc/init.d/wakeonlanconfig
This should produce no output and put you right back at the prompt you started at.
3. Use it. you'll need something to send wake-on-lan packets with, "wakeonlan" is in the repos. And you'll need the mac address of the system.
To get your MAC address, on the same system you just enabled WOL on, type:
ifconfig | grep HW
its the thing that looks like 01:23:45:67:89:ab , write it down and turn off that system:
sudo halt
In MOST cases, you CAN SEND wake on lan packets from a wireless connected computer.
If that doesnt work, its likely the port on the system your trying to wake up isnt the default (9), try 7, or if your BIOS settings or book told you one, use that one.
wakeonlan -p 7 01:23:45:67:89:ab
If that STILL doesnt work, make sure wakeonlan is enabled in your bios and your hardware supports it.
Original article
Комментариев нет:
Отправить комментарий