seriousm4x / UpSnap

A simple wake on lan web app written with SvelteKit, Go and PocketBase.
MIT License
1.88k stars 74 forks source link

[BUG] UpSnap Doesn't WOL With IP Address #583

Open firefly2442 opened 1 month ago

firefly2442 commented 1 month ago

The bug

I was having trouble getting UpSnap to wake a machine. I tested to make sure I could get it working outside UpSnap.

wakeonlan <macaddress>

This works. Then I tried within the container.

docker exec -it <id> sh
apk update
apk add awake
awake <macaddress>

This worked. However, when I try adding the IP address, anything I try fails.

awake -d 192.168.1.112 <macaddress>
awake -d 192.168.1.1 <macaddress>
awake -d 192.168.0.1 <macaddress>

In the UI, the IP address is marked as required. I wonder if perhaps this may not be needed and it should be optional?

The OS that UpSnap is running on

Ubuntu 22.04 (pi4)

Version of UpSnap

4.2.9

Your docker-compose.yml content

version: "3"
services:
  upsnap:
    container_name: upsnap
    image: ghcr.io/seriousm4x/upsnap:4
    network_mode: host
    restart: unless-stopped
    volumes:
      - ./data:/app/pb_data
    environment:
      - TZ=America/Chicago # Set container timezone for cron schedules
    healthcheck:
      test: curl -fs "http://localhost:8090/api/health" || exit 1
      interval: 10s

Reproduction steps

See above steps for testing using `awake`.

Additional information

Thanks

firefly2442 commented 1 month ago

I should also note, all machines are on the same subnet.

firefly2442 commented 1 month ago

See also #557

firefly2442 commented 1 month ago

As a work-around, I was able to use the custom wake command feature to enter my own command after adding a custom Dockerfile to add the awake binary. Custom command:

awake <macaddress>
seriousm4x commented 1 month ago

The IP is marked as a required field because of 2 things:

So an awake equivalent to what upsnap does would be awake -b 192.168.1.255 -p 9 <macaddress>. If that awake command works but upsnap doesn't, there might be an issue.

ax42 commented 1 month ago

I don't need the awake checking, just the WoL. Would it be possible to make the IP field non-mandatory and then a) not do awake checking and b) assume a standard broadcast mask?

jordancrawfordnz commented 1 week ago

This may not be relevant - but I thought I was having this issue. I confirmed the awake -b 192.168.1.255 -p 9 <macaddress> command from @seriousm4x above worked but it still wouldn't WOL from UpSnap directly.

But then I realised that I'd incorrectly configured my netmask as 255.255.255.255 rather than 255.255.255.0 I think I had done this because 255.255.255.255 is the placeholder value so I didn't really think about it and just entered this value. After fixing this value my WOL works perfectly.

My guess is that if this is misconfigured it was picking the wrong broadcast URL to fire the UDP packet to?