Wake On LAN under Linux

From Thomas-Krenn-Wiki
Jump to navigation Jump to search

This set of instructions will describe how to use the Wake-on-LAN (WOL) feature under Linux to wake up servers.

Activating Wake-on-LAN

So that WOL can be used, this feature must be supported by the network card and enabled.

This capability can be checked with the help of the "ethtool" utility for the respective network card (eth0 in this example).

ethtool eth0
Settings for eth0: 
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: umbg
        Wake-on: g
        Current message level: 0x00000007 (7)
        Link detected: yes

The supported WOL modes can be seen on the report under "Supports Wake-on". The modes that were active at the moment when the utility was run can be seen under "Wake-on".

The following is a list of the potential WOL modes (extracted from "man ethtool").

p  Wake on phy activity
u  Wake on unicast messages
m  Wake on multicast messages
b  Wake on broadcast messages
a  Wake on ARP
g  Wake on MagicPacket(tm)
s  Enable SecureOn(tm) password for MagicPacket(tm)
d  Disable (wake on nothing).  This option clears all previous options.

If MagicPacket(tm) should be used to wake up a server, that mode must be enabled for the respective network card using the following command.

ethtool -s eth0 wol g

If the desired WOL mode has not already been enabled by default, it can be set with the help of an init script or by using a parameter for the network module (see [1]).

Waking up Servers using MagicPacket(tm)

When a server should be woken up by a MagicPacket(tm), the "wakeonlan" (under Debian) or "wol" (under RedHat, CentOS or Fedora) will be required.

With it, the corresponding server can be woken up by specifying its MAC address.

wol XX:XX:XX:XX:XX:XX
Waking up XX:XX:XX:XX:XX:XX...

Links


Author: Florian Hettenbach

Related articles

AMD EPYC Server with Ubuntu - Enable SATA Hot-Swap
Data Synchronization with rsync under Linux
Linux Storage Stack Diagram