5. Configuring Wake-on-LAN

Wake-On-Lan allows a computer to be turned off by a network message.

Requirements for the destination computer

  • ATX power box, motherboard with Wake-On-Lan support
  • hardware support of Wake-On-LAN
  • MAC address of the network adapter

Requirements for the main computer

  • a program that can send the Magic Packet

How it works

The direction computer is in standby mode and is feeding the network adapter. The adapter is in economy mode: it examines all packages sent to its MAC address, but does not respond. If one of them happens to be a Magic Packet, the network adapter то will give a signal to wake the computer.


You must switch the WoL support on in the destonation computer's_BIOS_. The field you need may be called Wake On Lan Enable or Power On By PCIE or any other like that; it may also happen that your BIOS does not allow setting this mode while the motherboard supports it by default.

If you do not know whether your network card supports WoL, load the destination computer and enter in the console:

ethtool eth0

It will return something like:
Settings for eth0:
        Supported ports: [ MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 1
        Transceiver: external
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d
        Link detected: yes

You will need the lines Supports Wake-on and Wake-on. The first of them shows the available wakeup modes for the network adapter (actually, g stands for wakeup with Magic Pocket) and the second shows the current mode (d stands for WoL off).

To switch your network card to WoL mode, execute:

ethtool -s eth0 wol g

To set WoL on, enter:
ethtool -s eth0 wol d

The adapter may save its final status, but it may also initialize it (usually setting it to d), that is why you need to set the required WoL mode at each booting.

To do so, add the lines below to /etc/conf.d/net, and they will set WoL mode on on all network adapters that support it:
preup() {
   if ethtool $1 | grep "Supports Wake-on:" | grep g >/dev/null;
       ethtool -s $1 wol g

To get the MAC address of the network adapter on the destination computer you should
  • execute on the destination computer:
     ifconfig -a
     eth0     Link encap:Ethernet  HWaddr 01:02:03:04:05:06
              inet addr:  Bcast:  Mask:
              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
  • display the ARP cache on the destination computer:
     Address                  HWtype  HWaddress           Flags Mask            Iface                 ether   00:01:02:03:04:05   C                     eth0                 ether   06:07:08:09:0a:0b   C                     eth0                 ether   0c:0d:0e:0f:10:11   C                     eth0
  • to cache all computers in the network, you can use the nmap tool: it will ping the network machines so that their MAC addresses are cached.
    nmap -v -Sp

    To wake the machine, use the wol tool on the main computer:
    wol MAC_address

As regards handling of the programs, be aware that all computers are not loaded immediately after they are switched on, because the network card feeding is not initialized (when the computer has not loaded yet and does not know which devices it must feed to receive special signals, including the Magic Packet). It means that you will have to do it manually the first time. If this is cumbersome (for instance, if the server is locked or is very remote geographically), you should set the power option Wake After Power Fail in your BIOS to ON.

Thank you!