Tuesday, May 11, 2010

Wake up your PC from internet



Wake up on lan technology use special "magic" packet in order to "wake up" a "sleeping PC" in a LAN environment. This packet can be UDP or ICMP, wake up software dependent. For the solarwind, it is using UDP port 7. See below sniffing:



Convention wisdom tells us that to use wake up on lan, the wake up on lan packet must be sent to the broadcast address of the segment where the PC to be woken up sits. Reason for this is apparent: The wake up packet must reach the sleeping PC. However a sleeping PC does not do ARP, hence the switch does not know where the sleeping PC is. Sending the wake up packet to the broadcast address (ip and mac) solve this problem nicely, or sort of.

But how do I wake up my PC when I am not at home? 192.168.40.255 does not work for me. Port forwarding? No way.. you can't translate the gateway IP to a broadcast address. But we do have a trick.

Remember the objective of sending the wake up packet to broadcast address is to ensure the sleeping PC gets the packet because it does not do ARP? How about creating a static CAM entry on the switch since we know the sleeping PC's MAC? Hmm.. sounds great but I am using some cheapo 50 bucks switch. We need a poor man solution. Let's see.. what happen to the switch when it sees a MAC where it can't find a hit in its CAM? It floods to all ports.. bingo! Why bother to do the static CAM?

Hence the solution is to create the following PAT entry at the ADSL router:

gateway_IP:outside port-> phantom_IP:inside port

in out case, it will be 119.x.x.x:7->192.168.40.144:7. The phantom IP is one that no one uses. Then create static arp to force binding between "phantom IP" and the "sleeping pc"'s MAC (Ensure your gateway ADSL router can do this):

192.168.40.144->0024.8C51.0661 (sleeping pc's mac)


Then what's left is to run the wake up on lan software, key in IP address 119.x.x.x and.. if things works well, you will find your PC reachable soon from your mstsc while u sitting at East Coast MAC. :)


No comments:

Post a Comment