WOL: The Magic Pack Adventures on Linux

    More recently, LeeMiller described how to use the “magic package” to remotely turn on a Windows computer, thank you very much.
    It is very strange that no one asked in the comments, - But what about Linux? Nothing happens, he does not have, at least, Start - Control Panel - Network Connections !

    Either everyone already knows everything, or nobody needs it, but I still risk writing about it.
    The post will be a creative revision 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’ll listen to wishes for transfer to another place.


    The whole theory and configuration of BIOS I omit, it is remarkable disassembled LeeMiller .
    Our task will be to make the network card remain in standby mode after turning off the computer. If in Windows it is enough to put one daw for this, then in Linux the network card settings are not remembered and they must be done every time the system starts. To do this, you need to make a script and put it on the OS boot.
    The experiments were carried out on Ubuntu, but I think that with "other Linux" problems should not arise.

    Let's get started


    - Select the required network card:
    ifconfig

    We observe the result like In this example, we have one network interface card, eth0. If there are several cards, then there are several :) - Now we create the script itself, for this you must first obtain administrator rights:
    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)




    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 pay attention to the parameters: -s eth0 wol means “force WOL eth0 cards” g - “wait for the magic packet”. WOL has five more options for what to expect, but this does not apply to this topic.

    - Set the rights:
    chmod a + x wakeonlanconfig

    - Create a symbolic link, make the script executable at boot time:
    update-rc.d -f wakeonlanconfig defaults

    The screen should display something like - Check that everything turned out fine, enter in the terminal
    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


    /etc/init.d/wakeonlanconfig

    If there was no output and the next line of input appeared, then everything went smoothly.

    - We check in practice.
    We print this manual, turn off the first computer and go to the second :)
    We send the package in one of the ways suggested by LeeMiller . If you don’t like the methods, I recommend my favorite, simple web service , which can be used even with the help of a browser on 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 knowledge!

    And thank LeeMiller for dumping karma from the magic pack, nothing would have happened without it.

    Also popular now: