The Wake On Lan Mesh (WOLMesh from here on in) is designed to help with managing the power of Remote Computers via Wake on Lan. With all the mayhem of COVID-19, many administrators find themselves supporting far more users remotely than ever before. Some have elected to allow their users to logon via Citrix CVAD / VMware Horizon / Microsoft RDP technologies that allow remote pc access.
This use case really falls down when the user accidentally or intentionally shutdown their PC. Or perhaps the PC is powered down due to power policies. Wake on Lan can help here if you happen to be on the same subnet, are able to broadcast and know the mac address of the PC.
WOLMesh aims to help people who have limitations around Wake on Lan today by providing a Web Portal and REST API to allow administrators to view power status of remote machines and power them on via other machines on the same subnet should they need to.
WOLMesh can also be configured to keep devices (registered, or manual) online during certain times. E.G. if you sent an online time between 9 AM and 5 PM, if a device goes offline, WOLMesh will attempt to wake it up. Further, if devices are offline and the online time begins (say 9 AM) WOLMesh will attempt to wake all the devices and keep them awake.
The target machines for WOLMesh can be deployed in three ways:
Registered Machines are machines running a WOLMesh agent. This agent maintains constant communication with the WOLMesh server, to report current user, and it's online state. The agent is extremely thin and allows the WOLMesh server to relay Wake on Lan packets to powered off machines on the same subnet.
Relays are like registered machines, they maintain a constant connection to the WOLMesh server but are designed strictly for non windows playforms such as MacOS or Linux. This usecase is really for leveraging inexpensive devices such as Raspberry Pi's to wake up subnets of devices.
Manual machines are added to the WOLMesh server manually (via DNS Name, Mac Address and the broadcast address) of the network they reside. Manual devices do not have a dedicated connection to the WOLMesh server, as such their online state is determined by ICMP.
In the case of manual machines, every 1 minute, the devices DNS name is looked up, the ip address is updated (if neccessary) and a 2 second ttl ICMP is sent to the device. Should the device fail to respond, it's considered down.
When a wake request is sent for a device, from the Web App or REST API, WOLMesh check's its active connections, if devices or relays are found on the same subnet, subnet local broadcasts are sent from up to 3 devices (configurable) to the mac address of the machine requested.
If the server is on the same subnet as the target device, the server will attempt to also send a wake up.
If no devices are online in the target subnet, and the server is not on the same subnet. It will attempt to perform a directed broadcast to the subnet. This will most likely be blocked by most networks, but it never hurts to try ;)
The WOLMesh Server is an ASP.Net Core Web API written in .Net Core 3.1. This service provides the following services:
The WOLMesh service needs to be run on a central server, or machine that will not be powered down and the agents must be pointed at it. Once the process is started, it accepts connections via SignalR as devices register themselves with the server. Devices are stored in the local.db (sqlite) database.
From the web portal, you can view the registered devices and their power state. You can also power devices on from the console.
From the REST API, you can list and power manage devices in bulk or in an automated fashion.
Requires .Net Framework 4.7.2
The WOLMesh Agent needs to be installed on all devices you wish to manage with WOLMesh. Once installed, you must configure the agent to communicate with the server via a SignalR websocket. Once connected, the agent monitors it's network connection and state and sends it to the server.
Once connected, the device can be leveraged to wake up other devices on the same subnet.
The WOLMesh Daemon is designed to be used for relaying Wake On Lan Messages from the server, to the Daemon, for machines on the same network as the Daemon.
Once installed, the nodeconfig.json file must be updated to point to the server, once the process begins, this Daemon will be used as a relay to wake up other devices on the same subnet.
In the publish folder above, you'll find both the agent and server zip file:
https://github.com/andyjmorgan/WOLMesh/raw/master/Publish
Download the above web service zip file and extract it on a machine (tested on windows 10 / Server 2016). Once extracted, run the following executable with administrator priveledges to start the web service:
WOLMeshWebAPI.exe
Once started, the webservice will begin listening on the default port of 7443. A self signed certificate will be created on demand. you can then browse to https://server:7443 to begin using the webapp.
Note: Please ensure to run the process as administrator to ensure it can bind to the local ip address, for remote access.
If you would prefer to run this as a service: here's an example command:
New-Service -Name "WOLMeshWebAPI" -DisplayName "Wake on Lan Mesh Web API" -BinaryPathName C:\wolmesh\WOLMeshWebAPI.exe -Description "This Web Application will wake Remote PC's leveraging Wake On Lan" -StartupType Automatic
https://github.com/andyjmorgan/WOLMesh/tree/master/Publish
"serveraddress": "https://recording.lab.local:7443",
https://github.com/andyjmorgan/WOLMesh/raw/master/Publish
sudo chmod +x /usr/bin/wolmeshclient/WOLMeshClientDaemon
sudo /usr/bin/wolmeshclient/./WOLMeshClientDaemon
sudo nano /etc/systemd/system/WOLMeshDaemon.service
[Unit]
Description=WOL Mesh Daemon Service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
ExecStart=/usr/bin/wolmeshclient/WOLMeshClientDaemon
[Install]
WantedBy=multi-user.target
3: reload the daemon, enable the service and start it:
sudo systemctl daemon-reload
sudo systemctl enable WOLMeshDaemon
sudo systemctl start WOLMeshDaemon
Check /var/log/WOLMeshCoreClientDaemon.log
This is my "I gotta do these things next" list. I welcome all suggestions.