YuGabe.WakeOnLan 1.0.0

dotnet tool install --global YuGabe.WakeOnLan --version 1.0.0                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local YuGabe.WakeOnLan --version 1.0.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=YuGabe.WakeOnLan&version=1.0.0                
nuke :add-package YuGabe.WakeOnLan --version 1.0.0                

WakeOnLan / "wol"

A no-nonsense, simple Wake-on-LAN implementation, that can be invoked via the command 'wol'.


wol <target MAC address>

<target MAC address> is a string containing exactly 12 hexadecimal characters (0-9, A-F, case insensitive) and any additional non-whitespace delimiters (':', '-', '_' etc.).


wol 12:34:56:78:9A:BC

wol 12345_6789!aBCdE*f

wol 123456789ABCDEF


For Wake-on-LAN to work, make sure that:

  • the current machine and the target machine are on the same local subnet,
  • the UDP port 12287 or UDP broadcasting is not blocked any firewalls on the network (including Windows Firewall and routers/switches),
  • Wake-on-LAN is supported by the target machine, as not all motherboards/Ethernet cards support it, and some only when the computer is sleeping,
  • Wake-on-LAN is enabled by the target machine (usually in UEFI/BIOS).

Notes regarding the source

The source code is essentially the following two lines of code:

using var client = new System.Net.Sockets.UdpClient("", 12287) { EnableBroadcast = true };
await client.SendAsync(Enumerable.Repeat<byte>(255, 6).Concat(Enumerable.Repeat(Enumerable.Range(0, 6).Select(i => Convert.ToByte(mac.Substring(i * 2, 2), 16)), 16).SelectMany(b => b)).ToArray(), 102);

In plain words, the 6 bytes FF FF FF FF FF FF are followed by the target MAC address 16 times, and sent to the UDP broadcast address on port 12287.

This is preceded by validation, and the documentation if wrong input is detected.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.0.0 271 5/2/2022