Wake on LAN
From Gentoo Linux Wiki
| Terminals / Shells • Network • X Window System • Portage • System • Filesystems • Kernel • Other |
Contents |
[edit] Wake-on-lan configuration
[edit] 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.
[edit] 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.
[edit] 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.
For a Marvell "Yukon" gigabit ethernet card, for example, use the 'New SysKonnect GigaEthernet support' (CONFIG_SKGE) driver instead of the 'Marvell Yukon Chipset / SysKonnect SK-98xx Support' (CONFIG_SK98LIN) (This new driver is included in the gentoo linux kernel sources.)
| Linux Kernel Configuration: Use new driver for Marvell Yukon cards |
Device Drivers --->
Network device support --->
Ethernet (1000 Mbit) --->
<*> New SysKonnect GigaEthernet support
< > Marvell Yukon Chipset / SysKonnect SK-98xx Support (DEPRECATED)
|
If you use the 3c59x.c driver from Donald Becker, you should add enable_wol=1 to the kernel command line (in grub/lilo).
[edit] Configuration Changes
[edit] 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.)
[edit] 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
[edit] Waking up
[edit] 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.
[edit] Windows Method
To wake up a computer using windows just use any of the programs below.
- SoftPerfect Network Scanner - A free multi-threaded IP, NetBIOS and SNMP scanner with a modern interface and several advanced features, including Wake-On-LAN and remote shutdown.
- FUSION WakeUp on LAN – A free Windows application to take advantage of turning on a remote PC through the net interface.
- WOL - Magic Packet Sender 2007 – A free Windows application to store MAC addresses and send Magic Packets. - Requires .NET runtime
- Intellipool Network Monitor - Network and Server monitoring software that can start computers with wake-on-lan on a schedule.
- AMD PCnet Magic Packet Utility - WOL application by AMD. It has a simple interface and a few nice features (like group announcements and scheduling).
- WakeOnLan (AquilaTech) - A free Windows WakeOnLan program that is full featured. WakeUp, Shutdown, Ping, global shutdown all in one. Requires .NET runtime
- WakeOnLan (Dipisoft) - A french freeware for wakeup, ping, restart, shutdown, close/lock session or hibernate distant computers. Works now in both GUI and commandline modes, last version is multilingual. Does not require .NET runtime.
Enter MAC address and IP then execute.
[edit] Mac Method
- Apple Remote Desktop - Multifunction tool with WOL capabilities
- Wake550 - OS X adaptation of Wakeonlan script
- WakeOnLan - A free utility and a Dashboard widget
Enter MAC address and IP then execute.
