Lubuntu 11.10 Wake On LAN

I’ve been doing a lot of messing about with different flavours of Linux over the past few days, and as I mentioned in my PS3 Media Server post, had one or two minor headaches.  One of these was that while my HP Microserver supported Wake-On-LAN (WOL), this didn’t seem to work with Fedora 16 (x64), but did with Ubuntu.

Eventually though I moved on to Lubuntu, and while I could have sworn blind WOL worked fine on Saturday night, it definitely wasn’t working last night – so my first task today was to rectify this, which I have done largely thanks to a WOL guide at a blog called Confounded Tech (and the comments following it).

So what went wrong and how did I fix it?

First thing I did was download ethtool using sudo apt-get install ethtool and then checked the output from the command ethtool eth0 (where eth0 was my network card).  What I was looking for was a “g” in the “Wake-on:” line, indicating that WOL was enabled. It was there – so while a lot of the guides talked about enabling this setting on startup, I figured I was ok to ignore that bit as it seemed to be ok.

Rather, the problem seems to be that Lubuntu wasn’t shutting down the network card correctly when I sent the shutdown command.  Rectifying this meant creating a script and putting it in two directories: /etc/rc6.d/ and /etc/rc0.d/.  The rcx numbers correspond to Linux “run levels“, with 0 being halt and 6 being shutdown & reboot.  The script would basically just make sure the network interface was closed correctly each time.

In the rcx.d directories there are a lot of scripts, all of which get called when the OS is entering the relevant run level. scripts starting with an S start a job and scripts starting with a K kill a job.  The numbers following the level indicate priority, where S (or K) scripts with a lower number are executed before those with the same letter but higher number.  My system had S35networking which presumbaly does some fancy stuff to shut down networking programs.

The following script should be created and placed in both /etc/rc0.d/ and /etc/rc6.d/ – I called mine S34wol.sh, hoping that would ensure it was executed at the right point in the shutdown process.

#!/bin/sh
ifconfig eth0 down
poweroff

And… ?

Well now my server responds to WOL packets sent from my Windows 7 Laptop using FUSION WOL.  It still, for some reason, refuses to respond to WOL packets sent from my phone using mafro’s Wake On Lan app.

Author: nerd.

An experienced IT professional, I used to run a number of small websites and spend a lot of time tinkering with my sites or my PC - back when I had free time.

1 thought on “Lubuntu 11.10 Wake On LAN”

Leave a Reply

Your email address will not be published. Required fields are marked *