BME-nodeservers / udi-wol-poly

Send WOL packets to hosts
MIT License
0 stars 0 forks source link

WOL Failing on Polisy #2

Open markthom59 opened 8 months ago

markthom59 commented 8 months ago

Hi, I installed your Wake On LAN Node Server on my Polisy. All seems correct, however, I can't get the WOL to work. I know it's working correctly as I have the Wake on LAN (Magic Packet) software from Microsoft loaded on my PC and it works just fine. I've attached the log file. It seems everything is configured correctly but it's not working. Thanks in advance for any insights you can give me.

Mark Wake-On-Lan_12-7-2023_112038-AM.zip

bpaauwe commented 8 months ago

the node server is just a wrapper around the python wakeonlan module (github.com/remcohaszing/pywakeonlan) . It simply make a call to that module

send_magic_packet(mac_address, ip_address)

Using the mac address and IP address you configure.

chadm commented 7 months ago

I am experiencing the same problem, though on EISY. FreeBSD 13.2 appears to be filtering UDP port 9 (and 7) egress from the EISY/Polisy at the IP stack. I ran experiments using wol (pkg install wol on the EISY), running tcpdump local to the EISY, then pulling the files back to my workstation via scp and examining them via wireshark. Ports 7 and 9 will not be emitted from the EISY (even as root), all other ports experimented with [6,8,10,1024,etc], wol emitted the magic packet from the EISY fine (all the way to the target machine).

Example experiments run whilst ssh'd into the EISY which appears to be running FreeBSD 13.2:

Command structure for UDP port 9 (as an example):

tcpdump -ni re0 -s0 -w eisy_09.cap "not port 22"

/usr/local/bin/wol -v -p 9 -i 10.11.12.255 a8:a1:59:a4:52:45
Command structure for UDP port 10 (as an example):

tcpdump -ni re0 -s0 -w eisy_10.cap "not port 22"

/usr/local/bin/wol -v -p 10 -i 10.11.12.255 a8:a1:59:a4:52:45
Command structure for UDP port 1024 (as an example):

tcpdump -ni re0 -s0 -w eisy_1024.cap "not port 22"

/usr/local/bin/wol -v -p 1024 -i 10.11.12.255 a8:a1:59:a4:52:45

The solution appears to be here in your implementation:

        LOGGER.info('Sending magic WOL packet to {}:30000 ({})'.format(self.mac, self.name))
        try:
            send_magic_packet(self.mac, ip_address=self.ip)

The above defaults to port 9, which appears to be swallowed by the FreeBSD 13.2 IP stack before it is emitted. If you permit a variable port, however, it emits correctly:

        LOGGER.info('Sending magic WOL packet to {}:30000 ({})'.format(self.mac, self.name))
        try:
            send_magic_packet(self.mac, ip_address=self.ip, port=self.port)

Scouring the interwebs, I see many have used port 40k or 32767. It would be apropos to accept a target UDP port in your web ui implementation (much like you already do for the IP address/broadcast) and stitch it through to the python implementation. Perhaps something akin to in the web UI:

Key: Name Value: MAC/IP/Port