I've recently needed to move my computer into a different room other than my office for a while. And while I have it in this room, I'd like it to not be on all the time. My desktop can suck a bit of powered just idling and I've done this for years now. Having an always ready to go computer has been extremely useful to say the least.

However "Wake on LAN" or WOL is something I've known about for ages. It's nothing new, But I've had issues with it over the years.  I never got it to work consistently. Now the last time I tried it was probably back when windows 7 was coming out of the woodwork. And my home network is now no longer some cheap Belkin router I picked up from Walmart. I've stepped into the world of Homelab. So let's get to it.

First off if you are new to Ubiquiti and networking like I am, glad to see you here. I am in no way a networking pro and find this stuff to be more of a hobby. So these instructions are mostly to clarify what I learned by scouring over the various forums and documenting in a clear way what worked for me.

Getting started

If you have the Ubiquiti USG there is a way to configure it with some advanced features that are not included in the controller UI. You can create a file called  config.gateway.json This particular file will persist across provisioning requests as you make changes to your USG (and other devices).

Something that wasn't clear is where you put this file. Originally I had ssh'd into the USG and created the file there at the root. This is not the place you want to put it. Instead you want to go into your controller config directory. For me, since I have my controller running in a docker container it was just a mounted volume to /data. Although how I am hosting it shouldn't matter. The location of the file should be the same. /data/sites/<name-of-site>/config.gateway.json

So with that out of the way, what do we put in it?

Broadcasting the packet

Based on the information I was reading what you need to do is create a firewall rule that maps to an IP address that hasn't been assigned to the port that you want your WOL to work on. (Whether or not it is supposed to be within your IP range I am not entirely sure. I suspect it doesn't need to to be.)

Once you have done that you create the config.gateway.json file with this format:

{
  "protocols": {
    "arp": {
      "nonAssignedIp": {
        "hwaddr": "ff:ff:ff:ff:ff:ff"
      }
    }
  }
}

After replacing `nonAssignedIp` with the Ip address you set your firewall rule to. With the mac address being generic, it should That should be it.

Disclaimer: This did not work for me.

What I actually had to do was create a port mapping directly to the IP within my network. Which defeats the purpose of the work above. If I figure out how to do it without doing that I will update this post. I would like to be able to wake up several computers on one port rather than needing to have a port open for each computer.

The thing I learned with this is that you can customize nearly everything with this config file. I noticed several things with NAT rules. So I still learned something new and now I know where to put the file for advanced configs or settings that I couldn't find on the controller.