Wake On LAN over wireless

What is it?

Wake On LAN is a mature technology for switching on computers over a network or remotely.

Why would I want it?

Perhaps you are a techy such as myself and you want to be able to switch customers computers on and work on them remotely (saves having to tell people to leave machines on if you are working after hours).

I also use it to switch on my Ubuntu machine upstairs when I am downstairs (saves me or my better half having to wait for boot or to get a file to or from the machine without physically going up there).

Is it easy to do?

Yes when you know how ;)

Before I go any further I will mention a caveat. Almost all of the WOL howto’s out there mention using a “magic packet” packet to wake the machine. Unfortunately I found out after much head banging and googling “magic packet” doesn’t work over wireless networks, apparently because wireless frames screw the magic packet up so that the wakee doesn’t recognise it any more.

So if you want to use WOL by sending the wake up through a wireless network your options are limited and it depends on the network card you have. At least 2 of the cards I have support a variety of WOL options “pumbg” and the other one only supports “pg”.

  • P stands for PHY activity
  • U stands for Unicast activity
  • M stands for Multicast activity
  • B stands for Broadcast activity
  • G stands for Magic Packet activity

Firstly I tried phy activity that had the unfortunate effect of starting the machine every few seconds. Then I graduated to broadcast which started the machine periodically (my thick wireless router is sending out broadcasts every hour or so). Eventually I settled on unicast here is how to get it working.

Begin by telling the NIC to use unicast wake up:-

ethtool -s eth0 wol u

You can confirm the command was successful by typing “ethtool eth0” and checking the output. It should be similar to the following:-

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: u
Current message level: 0x00000007 (7)
Link detected: yes

Then make a note of the target machines MAC address either by using ifconfig or looking at the arp cache “arp -n”.

Now you can shut down the target machine to test. Once the machine is off you could just type “ping 192.168.0.1“, where “192.168.0.1” is the IP address of your target machine. That will probably be enough to wake the machine as the MAC address will still probably be associated with the correct IP address in the ARP cache. The only complication comes when the target machine has been switched off for some time. Presumably the MAC to IP association will be removed from the arp cache as a stale entry at some point. Then the sending machine won’t know which MAC address to send the ping to!

We can simulate this by manually deleting the entry in the arp cache and then adding it back in as if the entry never existed. Type “arp -d 192.168.0.1” again where “192.168.0.1” is the IP address of the target machine. Then type “arp -n” to confirm the association has been deleted. Output should be similar to following:-

Address		HWtype	HWaddress		Flags Mask		Iface
192.168.0.1			(incomplete) 					wlan0

We can now add the entry back in:-

arp -s 192.168.0.1 00:16:17:65:B4:62

and check the entry was successful “arp -n”:-

Address		HWtype	HWaddress			Flags Mask		Iface
192.168.0.1	ether	00:16:17:65:B4:62	CM				wlan0

Finally you can type “ping 192.168.0.1” and make Frankensteinian euphemisms like “it lives” or “it breathes”!

Join the conversation

16 Comments

  1. Hello, can you tell us which wi-fi card you used. Mine does not respond to ethtool command, and from Windows I see no WOL option in its properties. It’s a D-link with Atheros chip. Thanks

  2. I apologise but if you read the title it says “Wake On LAN over wireless” it means waking up an ethernet card via a wireless network, not waking up a wireless card.

    As you may know Atheros chips have the best support available in Linux but most of the chipsets don’t support “wake on wireless” and even though a few do having searched around I can’t find a way for madwifi to take advantage of this functionality.

    Unless you are prepared to spend a lot of time and hair pulling I would recommend you don’t try to pursue this as you may well get nowhere.

    Good luck!

  3. John, thanks for the article, but actually Wake on Lan works on wireless cards, but it depends on the hardware. for instance I have an iMac and if you have apple routers (Air Port Extreme, or Time Capsule), you can do this really easy. See http://www.macworld.com/article/142468/2009/08/wake_on_demand.html

    Since I don’t have one of Apple’s router, I needed to do some googling to set this up for my iMac and found the following:

    http://n01getsout.com/blog/2006/11/16/wake-on-lan-on-linux-with-a-linksys-wrt54g/

    I even have the same router as the link above and I did the same set up and it is working properly, the iMac is connected wirelessly and I can wakes it up over the internet with no problem.

    Now I have a IBM/Lenovo thinkpad T60 which I’m using just for Linux and I was trying to set up the same thing since it has Intel Wireless 3945abg which works ok in Windows XP according to what I found on Internet, but the same guy couldn’t get it working with Ubuntu (yes he is dual booting).

    I would like to do this and I even tried ethtool but it does not work for wlan0 which is the wireless interface, but still no luck.

    Anyways sorry for the long comments and if you find something you can shoot me an e-mail.

  4. Hi Ralph,

    Thanks for the comment. Certainly at the time of writing and as a general rule “wake on wireless” which is what the previous commenter and I assume you were referring to, wasn’t available.

    While I acknowledge there may be certain wireless hardware – including 2009 MACs – which do implement it, there isn’t a wake on wireless standard which can be applied across disparate wireless cards. Wake on Wireless doesn’t exist then in the same sense that Wake on LAN does and isn’t likely to until such a standard is created.

    As I’m sure many people, possibly including yourself, are aware, the amount of effort and fighting that has gone into getting the wireless “n” standard ratified has been monumental. Given the amount of trouble this caused I can’t imagine the major wireless chipset manufacturers will be creating such a Wake On Wireless standard any day soon, 5 years down the line maybe.

    Anyway Happy New Year to you and thanks again.

  5. hello sir…i m new in this and m using Ubuntu as my distribution..
    i am not getting any link or my option Link Detected:No is showing like this…therefore i am not getting connected to my target but i am getting a response while i do pinging…please help…

  6. hello sir…i got pinged with my target and got connected…but now how can i remotely access the target computer…???

  7. Sorry to bring this up after 2 years. But i’m strugling to get this to work. My default settings was “Supports Wake-on: pumbg” / “Wake-on: g”. But even when I change it to “Wake-on u”. It still only wakes up with a magic packet. and after a reboot it changes back to Wake-on: g

    1. In GNU/Linux or *BSD you can use ethtool -alongside your machines BIOS options- to set WOL on every boot, just add:

      /usr/sbin/ethtool -s eth0 wol g (or even pg if you require that)

      to your init boot scripts/services.

      1. Indeed in Ubuntu you could add it to /etc/rc.local. Can’t remember what it is for CentOS/RedHat et al.

    1. You’ll just have to remember to reapply that one if you ever reinstall. I have a similar fix to a different issue, in that power saving on certain wireless cards increases ping times to 200-300 ms. Damned if I don’t nearly always forget to stick it back in until my connection turns to poop when I unplug the power supply.

      Glad you got it sorted anyway. :)

  8. Beautiful :)
    I started to use WOL on my home servers a few days ago and I was asking myself why one of them didn’t respond when trying to wake it up – the one which was in stand-by mode for 2 or 3 days.
    Although I’m not 100% sure because I’m not checked it yet, I’m most sure the problem is the sanitize of the ARP cache!
    Great article, clear and to the point. First time here and already enjoying the blog.

    1. Thanks very much. It’s great to get really positive feedback after all these years, finally!

      As you can see I haven’t posted in a while, I’m spending a lot of my free time on Google Plus, but I may well pick this back up thanks to your encouragement. :)

  9. I was hoping this article would be about waking up a machine that is connected to a wireless AP rather than waking up a wired target machine from a wireless machine. But thanks anyway!

    1. I did try it with wireless at the time, but it wouldn’t work. I think it was something to do with the way the wake packets are encapsulated inside the encrypted wireless traffic.

Leave a comment