Hacker News new | ask | show | jobs
Using Wake on LAN (WOL) Across the Internet (2010) (ptere.com)
43 points by invpt 1168 days ago
7 comments

An alternative with simpler networking is to to rig up a little Web server on your home OpenWrt router, listening on the WAN interface. When the URL is requested (with authentication of some kind), it runs `etherwake` with the hardcoded MAC address and the hardcoded interface (e.g., `eth1.1`).

Then your UI to wake up your machine, from anywhere in the world, would be to access that URL via a Web browser or `curl` script.

For accessing the machine once it's awakened, probably you have a single TCP port forward configured on the router, forwarded to the port on the machine for SSH or whatever service is exposed. No other networking config.

(You could alternatively code a small "wake-on-demand" program that runs on the router, and initially listens on the port that will be forwarded to the service of the machine, but is resilient against port-scanning (maybe in a service-specific way to validate requests before waking machine), and reliable in setting and unsetting the port forward in the router when the machine is up and down.)

My very simple solution is to use a smart plug and config the mainboard to wake on power.
But then you're draining your RTC battery. I used to have to replace my mother's PC's battery every 1-2 years before I understood she was leaving it unplugged for most of the day and told her to just leave it plugged in all the time.
A modern RTC should draw such low power from the battery (tens of nanoamps to maybe a microamp) that the life of a primary battery will basically match the shelf life. Indeed, many coin cells actually have a longer life with a small amount of current draw than in a fully open circuit (in a wrapper on a shelf).
How modern are we talking about? This was a Haswell system, I believe.

All I know is that in 20+ years of maintaining computers, hers was the only one I ever replaced a battery for, and since she's left it plugged in 24-7 I haven't replaced it again.

I can't speak for < 2010 or so, but even then 500 nA was common, and half that wasn't rare. I'd expect that we crossed 1 µA around 2003 - 2005, as a very rough guess. But that doesn't mean that every implementation is good, of course; totally possible for a board to do something stupid like have pull-up resistor sinking current continuously on that rail.
> But then you're draining your RTC battery

This is one of the most ridiculous things to care about. And no, a proper hardware doesn't chew up RTC battery even if unplugged for months.

It's very much an avoidable inconvenience to replace. I don't see it as ridiculous at all.

>And no, a proper hardware doesn't chew up RTC battery even if unplugged for months. It in fact takes over a year to completely drain. Perhaps two years. It's inevitable, as CR2032s are not rechargeable and the circuits begins to draw on it less than two minutes after the system is unplugged. Eventually the battery must run out.

> It in fact takes over a year to completely drain. Perhaps two years.

My experience says no.

ah if you shutdown your machine by OS, it stays off, and to remotely turn the PC on, I have to turn the smart plug off and on. So no problem with leaving the PC unplugged all the time.
$5 every couple of years sounds worth the convenience.

Might even save that much in idle draw over the lifespan of the battery.

This is such a simple, fantastic idea. I went to enable it but unfortunately it does not appear to be an option available in all BIOSes.
very few motherboard does wake on power
The feature is named auto power on, and is supported quite widely. Search for wake on power might not show positive result.
4 years ago I was active on this solution and I found only server-class machine has that auto-power-on, as of today my laptop and desktop still do not have that, it used to be a server or workstation feature only, did something change? google showed a few servers at the top still.
Curious if this may be due to oem construction?

Every motherboard I've used to build systems with has plenty of options in the firmware, APM being among the most user obvious. Integrated systems like laptops? Not so much.

All RTC/wake up methods are mostly absent since ~2015 in the BIOS of desktop motherboards. You need to configure it in your OS.
I connect to my Wireguard endpoint, then SSH into my home server and run a script that does etherwake for my desktop computer - a bit convoluted, but works well for when I need it.
I did something like this for an old boss, long long ago.

They would go to their vacation home each year, and a couple days beforehand I would boot their computers up and install updates and sync files etc. That way they could start working as soon as they arrived. Dyndns and a tiny web server. Something something.net/mag1cpack3t

At work we tunnel WoL payloads inside DHCP packets (https://github.com/eait-itig/wolod) so we can use the DHCP relays on the edge network to push the packets out for us. The bootp procotol has a handy flag that indicates whether the last dhcp relay should broadcast or unicast the message being relayed, which is very useful in this situation.
My setup is a router with OpenVPN server, always on raspberryPi and a sleeping server. iOS shortcuts can run commands over SSH. The RaspberryPi receives a command from the the iOS shortcut and wakes my home server with wakeonlan MAC:ADDRESS
This article says port forwarding won't work because the IP address is "lost" when the computer sleeps.

Is that still the case even if you've hard-coded an IP address using DHCP on the router?

Damn, wake on LAN, the memories. Used to disable this all the time back in the early 2000s when everyone was scanning ports.
Back then people hooked up their desktops directly to the Internet like it was nothing. It used to be, you could scan open ports on your IP range and find exposed SMB shares to rummage around in.
There was also a time where seconds after installing Windows XP and plugging the Ethernet, your PC would get infected. No browsing, no nothing.
I don't really believe that was ever a common occurrence. It wouldn't take mere seconds to detect a new device connected to the Internet. I can see it happening in a small LAN where one of the other computers is already infected, though.
Nah, it actually was. There was a point in time where windows was vulnerable without patches, but the limited ipv4 space was available with "bot-nets"/infected PCs. It probably was something Like minutes, so if you were quick between starting up and downloading the patch...
Minutes, I can believe.
> It wouldn't take mere seconds to detect a new device connected to the Internet

You don't need to detect. You just spam exploit packets to every possible IP address and hope some of them hit a vulnerable target.

How do you get the necessary bandwidth to do that? Well you make your malware do the spamming, so as the network of compromised hosts grows, so does the attack traffic, until everyone is spammed with attack packets every few seconds.

The same is happening nowadays, just open tcpdump on a WAN interface and watch the nastiness roll in - you'll see SSH connection attempts (trying to bruteforce credentials), HTTP requests (typically used to exploit shitty PHP CMSes), etc.

I think it was just messages being sent to and displayed by the Windows Messenger service.

https://en.wikipedia.org/wiki/Windows_Messenger_service

A common. I personally witnessed a desktop get MSBlast'ed two seconds after I punched in the IP settings (a public IP) on a freshly installed WinXP.
I just use a tiny OpenWRT router set up with Tailscale to wake my system up.
Is Wake on Lan still actively used?

I created WOL software, but didn't do a good job of maintaining it. :|

I use it to wake my NAS a few minutes before a backup job.

I've also built a reset-on-LAN card using an old wake-on-LAN-capable NIC and some simple circuitry to shape the pulse so it's suitable for the motherboard's reset signal. I send a WOL packet to the otherwise-unused address, and kapow, the presumably-wedged machine is no longer wedged!

Writeup here:

https://www.i3detroit.org/reset-on-lan-an-ethernet-aware-rem...

Very clever! I suppose the modern take would be one of the MCUs with Wifi (ESP8266-like) wire that to the power signal on a PC.
interesting, one could probably power it from the motherboard itself pretty easily, too!

One of the pins of the power switch is probably 5V (though possibly high impedance if a pull-up is used, so not much power).

But I think I'll rather look into one of these Pi-based "ilo" with HDMI in and USB gadget support to get remote access to the BIOS as well. It may also be useful for remotely debugging computers of family members :)

Yes, it is powered from the motherboard. The mobo's WOL header, if present, contains +5VSB, wake, and ground. It's intended to power the NIC since the motherboard's slots aren't powered when the machine is off. (At least, ISA slots weren't, and PCI added standby power in a later revision.)

Or, you can just tap the +5VSB line from the ATX wiring directly. It's the same as on the WOL header. USB-equipped boards tend to power the USB ports from standby too, to support USB wake events, whether from keyboards, modems, or whatever. Plenty of options.

If I were doing it again, yeah, I might use an ESP chip. That would give me power, reset, and serial, and I can always enable a serial console in my OS. I wonder if the ESP32's camera peripheral could read HDMI...

I almost exclusively boot my desktop via WoL, either by running the command from a laptop or hitting a button on my phone (homescreen shortcut -> termux script -> ssh to router -> send WoL to desktop).
I use it for my desktop computer from my laptop. I also use sunshine/moonlight to stream games in the living room, and moonlight also supports waking the PC up, so apparently there is demand for the feature.
I have a VPN between my home and work networks and I often leave my desktop in stand-by, so when I want to use my desktop for something, I SSH into one of my home servers and send a WOL packet to wake it up.
It is useful for IT staff especially on big properties or when working remote since we don't have to wait for a user to wake up a machine for us or go there ourselves, as long as one on the lan is reachable. I did this in 2022.