Wake on LAN with SuSE Linux 10.0


With my setup
  • nVidia Corporation CK804 Ethernet Controller (rev a3) on an Asus A8N SLI Premium mainboard
  • SuSE Linux 10.0
  • BIOS' "Poweron on PCI Devices" set to "enabled"

there is a problem to get Wake on LAN running.

With the following setup

  • Realtek RT8111D Ethernet Controller on aGigabyte GA-880GM-UD2H mainboard
  • SuSE Linux 11.4
  • BIOS' "PME Event Wake Up" set to "enabled"

I observed the same problem and could solve it with the same method described below.

The SuSE boot resp. shutdown script for getting up or down the network interfaces /sbin/ifdown calls ip link set dev $INTERFACE down which seems to disable wake on lan feature of the ethernet controller.

To get around this problem I put up and successfully tested the following mechanics:

The SuSE /sbin/ifdown script has implemented the option to define a script which is run after the shutdown of each individual network device. To get executed such a script, the variable POST_DOWN_SCRIPT in the network devices' configuration file /etc/sysconfig/network/ifcfg-eth-* must be set to to the file name of the script to run. An example script is listed below.

Be aware of the fact that not every ethernet hardware or driver supports wake on lan. E.g. the driver for the Marvell Technology Group Ltd. 88E8001 Gigabit Ethernet Controller (which is also installed on the Asus A8N SLI Premium mainboard) has not implemented the wake on lan enable (maybe this has changed with the most recent version of the driver). So make shure by using ethtool that wake on lan is really supported. A call to /usr/sbin/ethtool eth0 (as root) should reveal a line like:

Supports Wake-on: g

Where the shown characters mean:

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.

And don't forget to enable "Poweron on PCI Devices" or similar in the Bios setup.

Here comes the example of a /etc/sysconfig/network/ifcfg-eth-id-XX:XX:XX:XX:XX:XX:

BOOTPROTO='static'
BROADCAST=''
IPADDR='192.168.106.203'
MTU=''
NAME='ASUSTeK K8N4-E Mainboard'
NETMASK='255.255.255.0'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
UNIQUE='xxxxxxxxx'
USERCONTROL='no'
_nm_name='bus-pci-0000:00:0a.0'
POST_DOWN_SCRIPT=enable-wol
      

My script which is shown below brings up again the ethernet device and then uses ethtool to enable it's wake on lan feature.

Below my script /etc/sysconfig/network/scripts/enable-wol:

#!/bin/bash
#
# $Revision: 1.3 $, $Date: 2006/08/04 15:29:14 $
#
# Copyright (C) 2006 Zoologisches Institut und Programm MGU, Uni Basel
#                    Lukas Zimmermann, lukas.zimmermann@unibas.ch.
#                    All rights reserved.
#
######################################################################

# mode of "g" is wake on MagicPacket
WOL_MODE=g

# debugging
#LOG_LEVEL=7

# change the working direcory and source some common files
#
R_INTERNAL=1      # internal error, e.g. no config or missing scripts
cd /etc/sysconfig/network || exit $R_INTERNAL
# config has at least USE_SYSLOG
test -f ./config && . ./config
test -f scripts/functions && . scripts/functions || exit $R_INTERNAL

# check the command line arguments
if [ $# -gt 0 ]; then
  CONFIG=$1
  shift
else
  exit $R_USAGE
fi
if [ $# -gt 0 ]; then
  INTERFACE=$1
  shift
else
  exit $R_USAGE
fi

# set the interface up and running again
debug "`printf "    interface %s is getting put up again." $INTERFACE`"
if ! ip link set up dev $INTERFACE ${LLADDR:+address $LLADDR} ; then
  logerror "Cannot enable interface $INTERFACE."
  exit $R_NOTRUNNING
else
  debug "`printf "    interface %s link has successfully been put up again." $INTERFACE`"
fi

# enable the wake on lan feature
debug "`printf "    enable WOL for interface %s." $INTERFACE`"
/usr/sbin/ethtool -s $INTERFACE wol $WOL_MODE

# check whether the enabling was successful
wol_status=$(/usr/sbin/ethtool $INTERFACE | grep Wake-on: | grep -v Supports \
  | sed -n -e 's/^[[:space:]]*Wake-on:[[:space:]]*\([^[:space:]]*\).*$/\1/p')
if [ "$wol_status" == "$WOL_MODE" ]; then
  msg='Successfully set WOL status for interface %s to \"%s\".'
  message "`printf "$msg" $INTERFACE $wol_status`"
else
  logerror "Enabling WOL on interface $INTERFACE did not work."
  msg='    WOL status is \"%s\" but should be \"%s\".'
  debug "`printf "$msg" $wol_status $WOL_MODE`"
fi
      

Finally you need a program which assembles and sends a MagicPacket to the network where the machine to be waken up listens. Such a program is e.g. Donald Becker's ether-wake. Have a look at his web page on the topic.
Or you could use wol program, which is included in SuSE 10.0 distribution.

More on wake on lan with linux you can find at the Wake on LAN mini HOWTO

line
linux logo HOME Powered by Apache
line
This site maintained by:
lukas.zimmermann@unibas.ch
My public PGP key
last updated: 2011-04-07 Valid CSS! Valid XHTML 1.0 Strict