Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a couple of machines in my server room normally powered off which it's useful to be able to power up remotely.

One of them is an old dual-P3 IBM serverWorks Intel STL2 machine on which wake-on-LAN has performed flawlessly for years. I hit its MAC address with etherwake, and hey-presto there it is a minute or so later (unless it decided it was due an fsck).

The new system I'm having problems with is built on an Asus P5E3. In the BIOS' Power/APM settings wake is enabled for modem/PCI/PCIe devices. That alone doesn't let me wake it using etherwake, but if I use ethtool -s eth0 wol g to enable magic-packet waking, then I can... once. Following any boot (whether via WOL or power-on) the state seems to always revert back to 'd' (disabled). How can I get the state set by ethtool to "stick" indefinitely ?

All systems involved are Debian Lenny, 2.6.26 kernel. Motherboard network interfaces being used, no add-in cards involved.

Thanks for any help

share|improve this question

3 Answers 3

up vote 7 down vote accepted

You could use /etc/rc.local or some system boot scripts, but this wouldn't be the best way to do it. On startup your network interfaces are configured, sure, but there are other times when your network interfaces may be brought up or down and you will need this executed during those times.

You want to edit /etc/network/interfaces:

You should have a line like:

iface eth0 inet static

Underneath that, indented further, you want to create a post-up and post-down commands e.g.

iface eth0 inet static
    post-up /usr/sbin/ethtool -s eth0 wol g
    post-down /usr/sbin/ethtool -s eth0 wol g

Obviously, replace eth0 with the relevant interface if different.

See interfaces(5) for more information on post-up and post-down commands

man 5 interfaces
share|improve this answer
    
This seems to work well thanks. It's also in a bit more of an obvious location than rc.local. I'm still somewhat mystified where in the system the WOL state is persisted and what was clearing it though. –  timday Aug 16 '09 at 16:32
    
+1. this works. it is exactly how i do it on my debian machines. also editing /etc/network/interfaces is THE correct method for changing anything to do with network interfaces on a debian/ubuntu/etc system. –  cas Aug 16 '09 at 22:06

You can create a script named, for example, wakeonlanconfig which contains the following:

#!/bin/bash
ethtool -s eth0 wol g
exit

Then make the script executable

chmod a+x wakeonlanconfig

And make the script run on startup

update-rc.d -f wakeonlanconfig defaults

For more details please visit my blog article on using WOL with Thin Clients.

share|improve this answer

you can add

ethtool -s eth0 wol g

to /etc/rc.local before exit 0 ; this script is executed during every boot-up.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.