Search:  
Gentoo Wiki

Wake_on_LAN

This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other
Note: Before you edit anything, there may not be any need to edit anything. The indicator light for a nic may stay on when the power on the computer is off. If this is the case, take down the mac address of the computer you would like to boot (as noted below) and emerge wakeonlan and attempt to boot them. That the lights stay on is not a perfect indicator of whether they will boot, I have a couple of computers that needed the tutorial below and I have a couple of computers (with onboard nics), which wouldn't boot after editing /etc/conf.d/rc and /etc/conf.d/local.stop, but when I returned them to original, they booted fine.
Note: It's probably a good idea to first try if it already works, then try the "Gentoo method" (see below), and if that fails, check the Hardware, BIOS, Kernel and manual configuration changes.

Contents

Wake-on-lan configuration

Hardware Changes

Certain NICs need to be connected to the motherboard with a special cable for wake-on-lan. Most modern cards do not need this anymore, as they can do this via the PCI bus.

BIOS changes

The BIOS of your PC might need to be reconfigured to support wake on lan.

Typical values to search for are: "Wake on LAN", "Wake on PCI" or "PME Event Wake up". These are usually located in the power managment section.

Consult your motherboard's manual if you are unsure.

Kernel Changes

You should include ACPI or APM (Advanced Power Management) when compiling your kernel. However, APM is deprecated now and ACPI seems to work fine. You probably have included these already.

In case of trouble, make sure you have the correct drivers for your card. Certain cards need special drivers which support wake-on-LAN. For most cards this is not an issue.

If you use the 3c59x.c driver from Donald Becker, you should add enable_wol=1 to the kernel command line (in grub/lilo).

Configuration Changes

Gentoo Method

Baselayout >= 1.12.0 is now stable, you should first set RC_DOWN_INTERFACE to no in your /etc/conf.d/rc to enable WOL. If you use an older version of baselayout see the section below.

# RC_DOWN_INTERFACE allows you to specify if RC will bring the interface
# compeletly down when it stops. The default is yes, but there are some
# instances where you may not want this to happen such as using Wake On LAN.
RC_DOWN_INTERFACE="no"
Note: This is not true for Intel Pro 100 and Intel Pro 100+ ethernet cards. Rather, you have to set RC_DOWN_INTERFACE to "yes" for these cards instead!

This might be all that you need to do!

If not, you need activate wake-on-lan on your card. Emerge ethtool to control the Wake-On-Lan behavior of the card.

emerge -av ethtool

Now look at the wol abilities of our card, ethtool eth0, where eth0 is your ethernet card:

ethtool eth0
Settings for eth0:
       Supported ports: [ TP 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: 100Mb/s
       Duplex: Full
       Port: MII
       PHYAD: 32
       Transceiver: internal
       Auto-negotiation: on
       Supports Wake-on: pumbg
       Wake-on: d
       Current message level: 0x00000007 (7)
       Link detected: yes

Four lines from the end of the output, you see "Supports Wake-on:". This example tells you whether this card is able to do wol. If it says, "Supports Wake-on: d", the card does not support wol. Here, it says "g". "g" means that the card will wake on the special wol code. For the rest of the options, you can find their meanings in man ethtool.

The line "Wake-on: d" just says that this interface is not yet configured to accept wol.

Now enable wake-on-lan with ethtool, each time the computer is added by editing /etc/conf.d/local.start:

echo "ethtool -s eth0 wol g" >> /etc/conf.d/local.start

(You can add it to /etc/conf.d/local.stop, but in case of an improper shutdown it won't get set.)

Manual method

For older baselayout version, the manual method is desribed below.

In order to get WOL running on a gentoo box you need to enable it in your ethernet driver. You can do this with ethtool

ethtool -s eth0 wol g

where eth0 is your ethernet interface and g represents the wol mode. Have a look at the manpage of ethtool for further modes.

Beyond this you need to guarantee that your ethernet device is still up and running after the shutdown/halt procedure. Check for halt instrucitons in /etc/init.d/* and remove the -i option that shut down all network interfaces.

In Gentoo, there are typically halt instructions in /etc/init.d/shutdown.sh and /etc/init.d/halt.sh

The interface might need to be up when the machine is stopped. To do this, you might need to start the interface again with ifconfig eth0 192.168.1.12 up where eth0 is your network interface and 192.168.1.12 is the ethernet address you assing to it (should work with any address.)

To sum up the following should enable WOL on a gentoo system:

Edit /etc/init.d/shutdown.sh

Replace

#/sbin/halt -ihdp

with

ifconfig eth0 192.168.1.12 up
/usr/sbin/ethtool -s eth0 wol g
/sbin/halt -hdp


Waking up

Linux Method

Now we should take note of the client computer mac address, so that we can send the special wol code to it. This can be found by using ifconfig. It is the 12 hex digits, following HWaddr.

ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 01:23:44:55:66:77
          inet addr:x.x.x.x  Bcast:x.x.x.255  Mask:255.255.255.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:179703 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33020 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:253484021 (241.7 Mb)  TX bytes:6080626 (5.7 Mb)
          Interrupt:9 Base address:0x6000

In this case 01:23:44:55:66:77

You can now reboot and then shutdown. If possible check that the lights stay on on the switch/router/other network device for your soon to be wol able computer.

On the server machine, it is now necessary to emerge a tool to send the special wol packet to the client. I use wakeonlan, but there are many other utilities available for this purpose. emerge -av net-misc/wakeonlan

It's now time to try it out.

wakeonlan 01:23:44:55:66:77 with your mac address.

If that doesn't work, it might be that your magic packet is not being sent through the correct interface or even sent at all. What worked for me is sending the packet to that interfaces broadcast IP address. In my case that was 10.0.0.255, you can check yours using ifconfig.

wakeonlan -i 10.0.0.255 01:23:44:55:66:77

If that still doesn't work and you are using the forcedeth network driver you may need to send the MAC address backwards.

wakeonlan 77:66:55:44:23:01

This is a known kernel issue with the forcedeth driver version 0.56 (and reported to be reproducible against version 0.54) and is discussed on the following sites.


Windows Method

To wake up a computer using windows just use any of the programs below.

Enter MAC address and IP then execute.

Mac Method

Enter MAC address and IP then execute.

Retrieved from "http://www.gentoo-wiki.info/Wake_on_LAN"

Last modified: Wed, 13 Aug 2008 22:23:00 +0000 Hits: 25,515