Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



Windows PC only wak...
 
Share:
Notifications
Clear all

Windows PC only wakes up when MacBook Wifi is off

9 Posts
2 Users
0 Reactions
121 Views
(@wifiuser)
Active Member
Joined: 3 weeks ago
Posts: 4
Topic starter  

After a lot of painful diagnostic over several weeks, I have finally figured out that if my MacBook Wifi is on, the wake on lan magic packet doesn't work to wake up my pc, however if I turn my Wifi off on the MacBook, then it works (The ethernet is always on and has manual ip address on the same subnet directly connected to the pc).

Is there a way to force the app to use a network adapter to send the packet through? I know this can work because I tested this using Windows 11 in Parallels and used a Wake on lan tool with a bridged network (so Parallels virtual machine only connected Windows 11 VM to my Ethernet adapter that's plugged into the MacBook) and the wake on lan magically woke up the windows pc by using a windows 11 virtual machine running on parallels within my MacBook

I've tried every app I can think of but none of them sends the packet through the Ethernet unless the Wi-fi on the MacBook is turned off, for example

miniWOL v3

SWOL

WakeonLan

Wake on command

Wake me up

I can only wake up the windows pc (that is directly connected via ethernet to the MacBook) if I turn the wifi off, if someone can help me with this I would be grateful, as I know it can be done by using an emulated app in Parallels that I've forced a bridged connection to the Ethernet adapter (and not the wifi) so this is possible.


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2791
 

Hi WiFiUser 😊 

Apologies for the late response, I'd love to see if I can help 😊 

The WOL packet is send through the preferred network of your Mac, which (as far as I know) can be either based on the IP range you're working with, or the set priority in Network Settings.

You can try changing the network connection priority in the well hidden list:

 -> System Settings -> Network -> lower right corner, under the list of devices/services.

This will show a list with the preferred order of network devices, which you can change:

Personally I always put WiFi way at the bottom, since my Ethernet connections always are faster (even the 1 Gbps Ethernet is faster than my WiFi 6).

Note: I've have had my share of my Mac doing goofy things where it occasionally would jump back to WiFi. Since this can be user error on my end, your mileage may vary.

 

As for sending WOL forced through a specific connection: I am not aware on how to accomplish this. I open a network socket to send the package. macOS fully controls what connection is being used. When looking at Parallels, I'd say they use a far more complex virtual router (by lack of better words and only as far as I can guess), allowing them to route traffic in very specific ways.

I'm sure you did some extensive testing.
I just tested this, that I can wake up my QNAP NAS when my Mac only has WiFi active.

This made me wonder about a few things:

  1. Is your WiFi network in the same IP range as your Ethernet connection and the device you'd like to wake up?
  2. Is your WiFi router stacked on top of another router (most firewalls will block WOL signals, so NAT on top of NAT may prevent this from working)?

   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2791
 

p.s. let me know if any of this helped (no hurry) - I'd be very happy to see that we get this issue resolved 😊 


   
ReplyQuote
(@wifiuser)
Active Member
Joined: 3 weeks ago
Posts: 4
Topic starter  

@Hans Hello Hans, thank you for the detailed response.

 

Just to answer some of your points:

  1. Yes I set the order with the Ethernet having priority in terms of the order as below

    This has not worked unfortunately, if I turn the Wi-Fi off, then it will work.

     

  2. On the MacBook, the Ethernet is 169.254.9.90 with subnet of 255.255.0.0 and the wi-fi is 192.168.1.160 with subnet 255.255.255.0 and has a router gateway - could this be a reason why it won't work? The Wi-fi and Ethernet are two separate devices I think this could be part of the issue

Some things I did to cross-check my theory:

  1. I tested in Windows 11 laptop and connected directly via Ethernet to the Windows 11 PC, and used a free Wakeonlan app that allowed me to manually select which adapter I send the wake on lan command through - so this was ok and it worked fine/correctly so I know that it's possible
  2. I created a Python script on my MacBook using Visual Studio Code and ran it - This forces a wake up packet using the specific network adapter with the specific manual IP that I set - for now this is a temporary solution as I have the wakeup.command script that runs this python script using "python3 wakeup.py" to actually wake up my pc (even when it is turned off it still wakes up which is perfect) - is it possible for you to implement something like this in your app? as I paid for v3 and it would be nice to have an update that accommodates this for advanced use cases? I don't want to always use a script or rely on python installation for this simple task - I might put this on GitHub for others to use as I couldn't find anything

    The script is below that worked for me:
    I used a WakeUp.command file - in this I used the following code:

    cd "$(dirname "$0")"
    python3 wake.py

    In the wake.py file, I used this python code (you need python3 installed of course):

    import socket;
    mac_addr = 'XX:XX:XX:XX:XX:XX'.replace(':', '');
    # This is the mac address of the pc you want to wake up - please edit this into the variable

    data = b'\xff'*6 + bytes.fromhex(mac_addr) * 16;
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM);
    s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1);
    s.bind(('169.254.X.X', 0));
    #Bind to the Ethernet adapter from where you will send your wake on lan command

    s.sendto(data, ('<broadcast>', 9))

If you could incorporate something like this I think it would make your app much better than the other options, as no other macOS app for wakeonlan that I could find allows you to send a wakeonlan command from a specific IP on the local network (except the above script, which I had to make myself)

This post was modified 3 weeks ago 3 times by wifiuser

   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2791
 

Posted by: @wifiuser

On the MacBook, the Ethernet is 169.254.9.90 with subnet of 255.255.0.0 and the wi-fi is 192.168.1.160 with subnet 255.255.255.0 and has a router gateway - could this be a reason why it won't work? The Wi-fi and Ethernet are two separate devices I think this could be part of the issue

1. There is a chance that this is causing this indeed. The firewall (or NAT) in the router will most likely block the WOL packet. Since WOL uses typically port 7 or 9 (UDP), you could consider using port forwarding. However, you may want to consider possible consequences by opening a port like that.

2. Keep in mind though that there may be something wrong with your Ethernet IP range. The range 169.254.x.x should not be used, as they are reserved for scenario's when a NIC needs a network address, but is set to DHCP and there is no DHCP server available. This points to either a misconfiguration of your ethernet connection, or router. It could be very well that this also limits traffic by your router.

Private IPv4 address ranges should be in one of these ranges:

10.0.0.0      to   10.255.255.255
172.16.0.0    to   172.31.255.255
192.168.0.0   to   192.168.255.255

 

As for including this in my app:
As far as I know: the OS will handle the routing automatically and (in your case) may very well ignore the 168.254.x.x IP address when the other address (WiFi) is available, thinking something is wrong with that NIC's configuration.

I will have to do some research on how to implement this, as I'm unfamiliar with doing a bind like this - I'll first have to see if the tools I use even support this. not to mention: have to figure a setup to even test this. I will look into it though, as I can see there is a bind option in API that I use - not sure if this will do the trick or is intended for this purpose.


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2791
 

Just did a few tests with miniWOL with my Mac connected to the WiFi (192.168.1.x) and Ethernet (10.10.10.x).
The device I'm trying to wake up is my NAS which resides in the 10.10.10.x range (the ethernet connection).
The firewall/NAT on the WiFi router (Fritz!box) is not allowing WOL packets to pass.
Neither is the firewall (OPNSense) on my Ethernet connection.

Tests show that WOL wakes up my NAS with or without WiFi connection.
Obviously, it doesn't wake up my NAS when I have only a WiFi connection.

Maybe a good idea on your setup to do a test with a proper IP address for your Ethernet range?
That would eliminate the issue that your Mac may think that the 169.254.x.x range is not legit (probably good for a macOS bug report as well).

Anywho, just thought I'd share these results 😊 


   
ReplyQuote
(@wifiuser)
Active Member
Joined: 3 weeks ago
Posts: 4
Topic starter  

Hello Hans,

Ok so on my MacBook my Wi-fi IP is as before (192.168...) and my ethernet is now 10.0.0.90 with subnet of 255.255.0.0 

On the PC, the ethernet is still the same as before (169.254...) but it is switched off (so only power socket is on but the pc is off - so the IP address shouldn't matter here as the packet is waking up based on the Mac address of the pc ethernet card).

It still didn't wake up the PC (169.254...) unless I modify my python script with the new ip for which adapter I should send the packet from (10.0.0.90)

I will try changing the IP on the pc to check if it makes a difference but I don't think it will make a difference.


   
ReplyQuote
(@wifiuser)
Active Member
Joined: 3 weeks ago
Posts: 4
Topic starter  

Hello Hans, I finally have some good news for you. For context my IP configuration is as below

Macbook:

  • Wi-fi adapter: 192.168.1.160 with 255.255.255.0 subnet
  • Ethernet adapter: 10.0.0.1 with 255.255.0.0 subnet 
    Note: Ethernet adapter is DIRECTLY connected to the PC using ethernet cable

Windows 11 PC:

  • Ethernet adapter: 10.0.0.2 with 255.255.0.0 subnet

I disconnected the network and shut everything down then restarted it fresh so it uses the new settings.

The good news

I can now wake it up from sleep successfully but only if I use the following broadcast mask 10.0.255.255 (it does not work if I use 255.255.255.255)

I am very happy with the solution - now I don't need to use the script anymore. I don't understand why the broadcast mask is 10.0.255.255 and not 255.255.255.255 but it doesn't matter now as it works.

Buying your app was worth it for the support.

Just to confirm, it wakes up when the PC is off (completely off but power cable is on) and when it is in sleep mode.

Just some product feedback, I think it is a good idea to have something like the script that I made into the app so it can help diagnose these kind of issues, as Windows wake on lan apps have option to force specific adapter or send from IP the wake on lan command, just to enhance your app. For example maybe an option to send the packet from a specific IP address only or specific adapter.

I think because I am not a network expert so I just used the IP that windows gave me by default, which was 169.254.x.x (I didn't know about the 10.x.x.x range) so this really helped to fix the problem. Thanks for educating me on the networking aspect of it.

You should put in the app also the explanation of which IP ranges devices should be in for some education of the users.

Thank you again and I appreciate all the help you've given me.


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2791
 

Great to hear you're happy with how things work now, and pleased to hear you're happy with your purchase 😊 

Indeed odd that 10.0.255.255 works as a broadcast mask, but not 255.255.255.255. After all 255.255.255.255 should mean "all IP addresses".
My best guess is that something is still not quite right with your configuration.

Not sure how helpful this is, but this is how I have setup my networks.

I have my Internet connection going straight to my ethernet based router - which in essence can be any kind of router that has DHCP, NAT, DNS etc.

My WiFi however is handeld by an Asus WiFi Router which has pretty much everything disabled. So DHCP, DNS, firewall etc - it is all disabled.
By doing so the router becomes a "dumb" switch, of which one "port" happens to be the WiFi connection(s).

From my WiFi router, I use a LAN connection to connect to my other router. So I'm not using the WAN connection of the WiFi router.

Since the WiFi router is now dumb, all the DHCP requests, firewall, etc, is being handled by the other router.

In a rough drawing:

Thanks for the product feedback - I'll take it in consideration (script and explanation) - I am however trying to keep the app as simple as possible. Let's see where I can squeeze that in 😉 

Happy I could help, and note that I'm not a network expert either - thank you for showing me that I can select a specific port as well.

Feel free to ask if you have any more questions.
For now I'll mark this question as solved, if that is OK with you.


   
ReplyQuote
Share: