How to get ethtool wake-on-lan setting to "stick"?

10,813

Solution 1

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

Solution 2

you can add

ethtool -s eth0 wol g 

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

Share:
10,813

Related videos on Youtube

timday
Author by

timday

"The most amazing achievement of the computer software industry is its continuing cancellation of the steady and staggering gains made by the computer hardware industry." - Henry Petroski "What if we didn't take it to our limit...wouldn't we be forever dissatisfied ?" - Doug Scott "Problems are inevitable. Problems are soluble." - David Deutsch "The incremental increase in systemic complexity is rarely if ever recognized as a problem that additional complexity can't solve." - Charles Hugh Smith (OfTwoMinds blog) "If you don’t make mistakes, you’re not working on hard enough problems. And that’s a big mistake." - Frank Wilczek "Only those that risk going too far can possibly find out how far one can go." – T.S. Eliot "Engineers turn dreams into reality" - Giovanni Caproni (in Hayao Miyazaki's The Wind Rises) "When an Oxford man walks into the room, he walks in like he owns it. When a Cambridge man walks into the room, he walks in like he doesn't care who owns it." - my grandmother "The greatest scientific discovery was the discovery of ignorance" - Yuval Noah Harari. "Always train your doubt most strongly on those ideas that you really want to be true." - Sean Carroll "The first principle is that you must not fool yourself — and you are the easiest person to fool" - Richard Feynman "On the plains of hesitation lie the blackened bones of countless millions who at the dawn of victory lay down to rest, and in resting died." - Adlai E. Stevenson "Therefore Simplicio, come either with arguments and demonstrations and bring us no more Texts and authorities, for our disputes are about the Sensible World, and not one of Paper." - Salviati to Simplicio in Galileo's Dialogue On Two World Systems (1632) "The larger the island of knowledge, the longer the shoreline of wonder." - Ralph W. Sockman "I never enlighten anyone who has not been driven to distraction by trying to understand a difficulty or who has not got into a frenzy trying to put his ideas into words. When I have pointed out one corner of a square to anyone and he does not come back with the other three, I will not point it out to him a second time." - Confucius "The way to bring about the new age of peace and enlightenment is to assume it has already started" - ?

Updated on September 17, 2022

Comments

  • timday
    timday almost 2 years

    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

  • timday
    timday almost 15 years
    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.
  • cas
    cas almost 15 years
    +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.