![]() ![]() (You can also setup a script for turning off, but I prefer to make it harder to do this and do it manually). This basically puts a button in the Home app that allows me to turn on my PC. Currently I’m achieving this by using Homebridge with the homebridge-wol plugin. So you should be able to change the forwarding rule from "TCP and UDP" to "UDP only".I wasn’t able to figure out how to do this in Scriptable. as mentioned in the comments, Linux-based routers don't generally like transforming unicasts into broadcasts, so this approach might not work.Īn alternative solution would be to add a static ARP table entry for the target PC into the router's ARP table, so it would not need to make the ARP query, but could just proceed into forwarding the packet to the inner network.īy quick source code inspection, the wakeonlan python module seems to use SOCK_DGRAM, which means it uses UDP. So, if the netmask of your internal network is 255.255.255.0, then you should use 192.168.31.255 as the inner IP address in the forwarding rule.īut. That way, the router will not need to make an ARP query before passing the packet into the inner network. You would have to configure the forwarding rule send the magic packet into the broadcast address of the internal network, in order to make it a broadcast. For the router, the magic packet is just another TCP or UDP packet that will be processed just as usual. The fact that the MAC address is embedded into the magic packet payload does not help, because the router does neither know nor care about that. but the Python wakeonlan module does not seem to have the facilities to process such an error response, even assuming the ICMP message does not get filtered out by paranoid firewalls on its way back. A network interface that is waiting for wake-on-LAN packets is in a low-power receive-only mode: it will not typically be able to answer to ARP requests.Īs the ARP request fails, the router might send back an ICMP error packet indicating "host unreachable". but gets no answer, because the target PC is powered off. So, per the standard procedure for forwarding unicast traffic, the router will first make an ARP request to find out the MAC address of the target PC. The forwarding rule in the router specifies the target PC's own IP address as the inner IP address. ![]() The magic packet is addressed to the router's external IP address, which makes it an unicast packet. The tricky part in sending Wake-on-LAN packets in from beyond the local network is in getting the router send the packet out to the local network, so that the completely passive PC1 can receive it. Python3 wakeonwan-paramiko.py can wakeup my home pc from external network,i feel it is more simple to edit wakeonwan.py to wakeup pc remotely? Ssh.connect(host, username=username, password=password,port=10000) Ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) pip install paramikoĮidt wakeonwan-paramiko.py: import paramiko It encounter no error,why pc1 can't wakeup with wakeonwan.py? Send_magic_packet(mac, ip_address=target_ip,port=9) Turn off pc1,wakeup it from pc2 with the following python code wakeonlan.py: from wakeonlan import send_magic_packetĮxecuting the command python3 wakeonlan.py in pc2 can wakeup my pc1 successfully.Įxecuting the command python3 wakeonwan.py remotely(for example-in my company's pc) can't wakeup my pc1. Issue wol command from the router: /usr/bin/wol -i 192.168.31.255 xx.xx.xx.xx Which interface to choose from the below options? Name protocl outer port inner IP address inner portĪnd bind the ip address and mac in openwrt: ip address mac interface The openwrt is running on my router,adding some port forwarding rules in the router and open firewall: forwarding rule ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |