Skip to content

mrsamypnw/wol-api-container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wake-on-LAN REST API Container

A lightweight Docker container that provides a REST API for sending Wake-on-LAN (WoL) magic packets to wake up devices on your network.

Features

  • Web GUI for easy testing and manual wake requests
  • Simple REST API endpoint to send WoL packets
  • Accepts MAC addresses via POST requests
  • Optional custom broadcast address support
  • Health check endpoint
  • Runs on Unraid and other Docker hosts

Installation on Unraid

Option 1: Docker Compose (Recommended)

  1. Download all files to a directory on your Unraid server
  2. Navigate to the directory in terminal
  3. Run: docker-compose up -d

Option 2: Docker CLI

```bash docker build -t wol-rest-api . docker run -d
--name wol-rest-api
--network host
--restart unless-stopped
wol-rest-api ```

Option 3: Unraid Docker Template

Add a new container in Unraid with these settings:

  • Repository: Build from the Dockerfile or push to Docker Hub
  • Network Type: Host (required for WoL broadcasts)
  • Port: 3000

Usage

Web GUI

Open your browser and navigate to: ``` http://your-unraid-ip:3000 ```

The web interface provides a simple form to:

  • Enter MAC addresses with auto-formatting
  • Optionally specify a custom broadcast address
  • Send WoL packets with visual feedback
  • See success/error messages instantly

API Usage

Health Check

```bash curl http://localhost:3000/health ```

Send Wake-on-LAN Packet

```bash curl -X POST http://localhost:3000/wake
-H "Content-Type: application/json"
-d '{"mac": "00:11:22:33:44:55"}' ```

With Custom Broadcast Address

```bash curl -X POST http://localhost:3000/wake
-H "Content-Type: application/json"
-d '{"mac": "00:11:22:33:44:55", "broadcast": "192.168.1.255"}' ```

API Reference

POST /wake

Send a Wake-on-LAN magic packet to a device.

Request Body: ```json { "mac": "00:11:22:33:44:55", "broadcast": "255.255.255.255" } ```

  • mac (required): MAC address in format XX:XX:XX:XX:XX:XX or XX-XX-XX-XX-XX-XX
  • broadcast (optional): Broadcast address (defaults to 255.255.255.255)

Success Response: ```json { "success": true, "message": "Wake-on-LAN packet sent successfully", "mac": "00:11:22:33:44:55", "broadcast": "255.255.255.255" } ```

GET /health

Check if the API is running.

Response: ```json { "status": "ok", "message": "WoL REST API is running" } ```

Important Notes

  • Network Mode: The container must use host network mode to send broadcast packets
  • Firewall: Ensure UDP port 9 (WoL default) is not blocked
  • Target Devices: Devices must have Wake-on-LAN enabled in BIOS/UEFI and network adapter settings

Troubleshooting

  • If WoL packets aren't working, verify the target device supports WoL
  • Check that the container is using host network mode
  • Ensure the MAC address format is correct
  • Try specifying your subnet's broadcast address explicitly

Environment Variables

  • PORT: Server port (default: 3080)

About

Simple REST API that receives a MAC and Broadcast IP and generates a magic WOL packet for the server local subnet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors