Most recently,
LeeMiller described how to use the “magic package” package to remotely turn on a computer running Windows, thank you very much.
It is very strange that no one asked in the comments, - What about Linux? Nothing works, it does not have, at least,
Start - Control Panel - Network Connections !
Either everyone already knows everything, or no one needs it, but I still venture to write about it.
The post will be a creative reworking of my old
HowTo , published on forum.ubuntu.ru, written, in turn, after reading English-language manuals.
UPD: moved to "Iron", closer to the topic-motivator. It looks strange, I will listen to the wishes for transfer to another place.
')
I omit the whole theory and BIOS setup, it was perfectly
disassembled by LeeMiller .
Our task will be to force the network card to remain in standby mode after turning off the computer. If in Windows for this purpose it is enough to put one checkbox, then in Linux the settings of the network card are not remembered and must be made each time the system is started. To do this, you need to make a script and put it on the OS boot.
Experiments were made on Ubuntu, but I think that there should be no problems with “other Linux”.
Let's get started
- Select the required network card:
ifconfig
Observe the result like
eth0 Link encap:Ethernet HWaddr 01:23:45:67:89:ab
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::215:f2ff:fe6f:3487/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:71495 errors:0 dropped:0 overruns:0 frame:0
TX packets:76190 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23164212 (22.0 MiB) TX bytes:7625016 (7.2 MiB)
Interrupt:217 Base address:0xd400
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:1290 errors:0 dropped:0 overruns:0 frame:0
TX packets:1290 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:161182 (157.4 KiB) TX bytes:161182 (157.4 KiB)
In this example, we have one network card, eth0. If there are several cards, then there are several :)
- Now we create the script itself, for this you first need to get administrator rights:
sudo su
cd /etc/init.d/
gedit wakeonlanconfig
- We write the following lines to the file, save, close:
#! / bin / bash
ethtool -s eth0 wol g
exit
Here I want to draw attention to the parameters:
-s eth0 wol means “make the WOL eth0 card”
g - “wait for the magic packet”. WOL has another five options for what to expect, but this does not apply to this topic.
- We establish the rights:
chmod a + x wakeonlanconfig
- Create a symbolic link, make the script executable at boot:
update-rc.d -f wakeonlanconfig defaults
The screen should display 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
- We check that everything turned out fine, we enter in the terminal
/etc/init.d/wakeonlanconfig
If no output followed and the next line of input appeared, then everything went smoothly.
- We check in practice.
We print out this manual, turn off the first computer and go to the second one :)
We are sending the package in one of the ways proposed by
LeeMiller . If you do not like the methods, I recommend your favorite,
unpretentious web service , which can be used even with a browser in a cell phone.
- PROFIT!
I want to appeal to those who are smarter than me - if there is (probably there is) a more beautiful way of implementation - let us know, we will update our knowledge!
And thank
LeeMiller 'a for
dumping the karmas from the magic package, without that nothing would have happened.