Setting up Wake-On-Lan

As of last year I started putting my computer to sleep when I’m away to save power. In the future I’m about to go on a trip with my laptop; During trips I’d periodically access my desktop from my laptop via SSH or VNC, both machines run Manjaro with KDE Plasma. I want to leave my PC in standby when not used, but also be able to issue SSH commands or using remote desktop while away: For this I’ll clearly need to enable and use Wake-On-Lan which I’ve never worked with before.

My motherboard is an ASUS PRIME X370 PRO. I already enabled WOL from BIOS, I believe the option is called “Power On By PCI-E” which is now on. In generic Linux tutorials I read on the matter, I installed ethtool and used it to check if the feature is enabled by the system:

Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supported pause frame use: Symmetric
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Auto-negotiation: on
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        MDI-X: off (auto)
        Supports Wake-on: pumbg
        Wake-on: d
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes

Wake-on: d suggests this is disabled by the kernel, I understand I want it so say Wake-on: g for magic packet support. To do so at runtime I’m told to use sudo ethtool -s eth0 wol g: Is this the correct command? I’m confused why the OS doesn’t automatically enable WOL when the BIOS turns it on, hopefully that can be fixed by Manjaro unless there’s an explicit reason why it’s disabled.

The point I’m stuck on is what I’m supposed to use to send the magic packet: What is the best tool included in the official software packages for this purpose, once I install it what is its command? Obviously I will need to indicate my IP address and likely the port, which I figure I’ll need to port-forward in my router’s settings: How do I check which port it is, then what command do I try to make my laptop wake up my PC?

1 Like

You are on the correct path.

Make sure wake on lan is enabled in your bios.

Then to invoke it you need to send a magic package over your lan at home.
To activate over internet you have 2 choices.

If you have an advanced enough router, it is covered in the link above how to achieve the next step, otherwise I have one more solution for you:

You can have a cheap scb (a cheap raspberry pi can run manjaro arm), install pivpn (openvpn for rpi), open a port in your router/firewall and connect to it safely over the internet.

Then run something like etherwake or wakeonlan to wake up your pc.
After that you can just vnc to your computer since you are already on the lan via the vpn server.

You can also tunnel vnc over ssh to make it pretty secure if you can do the “advanced router” I method mentioned first and in the link above.

VNC is a VERY unsecure protocol, this will cover you a bit.

Good luck!

1 Like

I got around to trying this today but still can’t get it working. Please let me know what you think I might have missed and should try next.

First I enable WOL: sudo ethtool -s eth0 wol g. After that sudo ethtool enp8s0 | grep -i wake tells me: Wake-on: g. So this part should be in order. Obviously the feature is enabled in BIOS where I turned on Power On By PCI-E which should be enough for magic packet support.

In my router settings I’m forwarding ports 7-9 to my local IP address, both TCP and UDP for safe measure. In my KDE Plasma firewall the same ones are opened on both modes for testing.

From my laptop I use: wol -p 7 -i ROUTER_IP PC_MAC: I tried both port 7 and 9, with both the MAC address of my PC (interface connected to the router) and even the router’s just to be sure.

I can confirm the package itself is reaching my PC: If I run sudo tcpdump -i enp8s0 port 7 on either port, my console immediately prints the package sent by the laptop from the wol command on either port. As such everything seems fine with port forwarding on the router’s end.

But so far there’s no waking up from standby: The computer remains suspended until I press a button on my keyboard, none of those combinations sent from my laptop do it.

I can’t find a way to know exactly which port my motherboard expects the package on: Everyone says it’s either UDP 7 or 9, I tried both and neither is working. Is there a way to check which it is?

Did you add the rules to your WOL capable router described in the wiki?

ip neighbor add lladdr FF:FF:FF:FF:FF:FF dev net0

This example assumes the network is and uses net0 as network interface. Now, forward UDP port 9 to This solution was successfully tested on a Linksys WRT54G running Tomato, and on the Verizon FIOS ActionTec router. For notes on how to do it on a router with DD-WRT firmware, see this tutorial and for a router with OpenWrt firmware, see this tutorial.

If you do NOT have a sophisticated router enough:
Pretty sure it’s a security measure by your router to NEVER LET magic packages into your network.

I would recommend you closing those ports again and look into what hardware you will use to wake up your computer.
You can read my post above about it.

Pretty sure you do not need to provide an ip or port with etherwake or wol, you can set it to you complete ip range and that will work, not a particularly safe protocol to just “open up ports” for.

Try waking up your computer while ON the same network (not outside the internet) with a phone app or somehting, set the ip to spand the whole subnet.
Pretty sure your computer will wake up anyway because that is how magic packages work.
They “flood” the network with a “magic package” that EVERYBODY on the network can hear.

But just sending it to your external internet ip adress on port 9 will not work, and you should probably be pretty glad it doesn’t.

1 Like

Sadly I must conclude the feature is too unreliable and unpredictable to use on my system, I disabled it from BIOS and will have to do without. At first I tried to normally shut down my computer and it powered back up on its own, only stood down after a second shutdown: Following this I only once managed to get it to start via WOL, it was powered off and the laptop command turned it on… but upon trying to replicate the same success a second time it would never work again.

The router shouldn’t be at fault as it forwards the port accordingly and the PC receives the signal, though its port LED randomly goes on or off when the machine is in S3 / S4 / S5 state. I think WOL as implemented is too unreliable, at least the magic packet approach; There’s also a Power On By Ring option in the BIOS but I presume that’s for stuff like old dial-up modems and won’t do anything.

It’s not unreliable, its about security.

What you have to understand is the way wol works.

When a computer is powered off, they no longer have an ip, there is no active interface talking to the dhcp server (in this case I assume your router is taking care of handing out ip:s).
The only thing happening when wol is activated is that the network interface on your computer LISTENS to the network (can be on both wifi and eth, you noticed this when you activated it I hope). Usually you can identify this by watching if the lan port goes completely dark or is still connected when you power off your computer.

So to even be able to make this happen (because of how packaging on networks work, they need an ip f.ex) the magaic package protocol was created.

Imagine a situation where the setup you used were working. ANYBODY could just scan your network for open ports and then constantly spam you network with magic packages, you would NEVER be able to turn off your computer without disabling wol.

The raspberry pi setup is not really that hard or expensive.
Having a personal vpn is always a great way to get into your lan from the outside.
Also a great way to protect you if you are forced to use a public wifi, it encrypts everything and suddenly the public wifi is just as safe as anything else outside your home.

Downside is your internet speed might suffer a bit depending on your home internet connection.

Then there is ofc the payed vpn route if you want to go that way.
And no, I don’t mean the “vpn to watch content from other parts of the world”, I mean a vpn for the purpose you need. They are not that expensive tbh, but there is always the issue of “do you trust them”?
But the payed ones are usually super simple to setup.

Then there is also you buying another router that allows you to configure these things, that is also a solution. Also doesn’t have to ruin your wallet. openWRT is pretty darn capable.
Not sure how the data over VNC would be handled there, you do NOT want to transfer that over the internet!
But I think you can start an ssh session and then tunnel the vnc through that connection and then ssh will encrypt. I’m not sure, that is why I went with the vpn route for all the bonus goodies.

It was mostly for my peace of mind: I like to know my computer is working fine at home while I’m away on my laptop, in the process using ssh to keep it up to date. I no longer want to waste electricity having a PC run for no reason why I’m on a trip: I was going to awaken it for quick checkups then put it back to sleep, but if I can’t reliably do that remotely I may just power it off. My router will still be working so I can just log into that to know everything’s fine back home then sudo pacman -Syu when I return :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.