RHEL7 Wakeup on Lan Hibernate and Suspend

In this CentOS 7 or Red Hat Enterprise Linux 7 tutorial we take a look at how to configure Wake on LAN (wol) and how to suspend or hibernate your system. Also how you can configure suspend and hibernate in Gnome3 that has these buttons disabled by default. Also take a look at the tutorial adding UDEV rule and systemd service for wake on LAN.

Suspend/Hibernate in Gnome3

Red Hat Enterprise 7 or CentOS 7 comes with Gnome3. By default the hibernate and suspend buttons are disabled in Gnome3. You can enable hibernate and suspend buttons as separate items in the gnome panel by installing an additional package and follow some configure steps.

First check if the gnome-shell-browser-plugin package is installed (this package is available from the RHEL7 optional repository):


# rpm -qa | grep gnome-shell-browser-plugin

As we said before the package is available from the rhel-7-server-optional-rpms repository. You need to subscribe to the RHEL7 optional channel before you can install the rpm (if it isn’t already installed on your system). How to subscribe to the RHEL7 optional channel you can find here.

After subscribing you can install the rpm using:


# yum -y install gnome-shell-browser-plugin

You need to install an additional extension by opening “gnome-tweak-tool”, select “Shell Extensions” option and click on “Get more Extensions”.
This will open the URL https://extensions.gnome.org in your browser. Search for “Alternative Status Menu” by gcampax extension and install it on your system. This will provide suspend and hibernate options when you click on the “username” in gnome-panel of Gnome3.

Command-line Hibernate and Suspend

Of course, it’s also possible to suspend and hibernate the system from the command-line. Open a terminal and try the following:


# systemctl hibernate

and

# systemctl suspend

or ignoring logged-in users on the system with -i

# systemctl suspend -i

or the command:

# pm-suspend

Wake-up on LAN Configure

Now that we know how to suspend and hibernate the host, we need to configure the ethernet NIC so it is able to wake-up on lan (wol). The NIC can have different Wake On LAN states which you can see and change with the command ethtool. First let’s see the current state and supported states of the NIC:



# ethtool eth25s0
Settings for eth25s0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Speed: 100Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: Unknown
    Supports Wake-on: pumg        <-------supported states
    Wake-on: d                  <-------current state(s)
    Current message level: 0x00000007 (7)
                   drv probe link
    Link detected: yes

Use the man page of ethtool to find the mode descriptions:


wol p|u|m|b|a|g|s|d...
Sets Wake-on-LAN options.  Not all devices support this.  
The argument to this option is a string of characters specifying which options to enable.

              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™
              s   Enable SecureOn™ password for MagicPacket™
              d   Disable (wake on nothing).   This  option  clears  all
                  previous options.

As you can see our NIC configured state is not to wake on nothing!

To configure the NIC to Wake on MagicPacket you use again the ethtool:



# ethtool -s eth25s0 wol g
# ethtool eth25s0
Settings for eth25s0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Speed: 100Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: Unknown
    Supports Wake-on: pumg
    Wake-on: g
    Current message level: 0x00000007 (7)
                   drv probe link
    Link detected: yes

You'll need to persistently set the option if you always want to use it, by using the ETHTOOL_OPTS parameter in the interface configuration file for the interface in the /etc/sysconfig/network-scripts/ directory:


ETHTOOL_OPTS="-s ${DEVICE} wol g"

Wake on LAN in BIOS

Wake On LAN is a hardware feature so you'll need to make sure that the BIOS of the system is configured to use Wake-up on LAN (wol). See the vendor page of your motherboard/BIOS for more details.

That's it for this tutorial on Wake on LAN and suspend/hibernate.

Edit: some people complain that the ETHTOOL_OPTS in the /etc/sysconfig/network-scripts/ifcfg-<NIC> doesn't work. I've created a new tutorial called:
Adding UDEV rule and systemd service for wake on LAN.

This entry was posted in Linux Administration. You can follow any responses to this entry through the RSS 2.0 feed. You can trackback from your own site. Tweet This! Tweet This! or use to share this post with others.

There is currently one response to “RHEL7 Wakeup on Lan Hibernate and Suspend”

Why not let us know what you think by adding your own comment!

  1. Tweaking4All.nl - Op afstand Computers wakker maken met Wake On Lan on May 11th, 2016:

    […] CentOS 7 / Red Hat […]

Leave a Reply: