Monday, June 11, 2012

How to make a remote connection to your home computer.

This tutorial is intended for medium to advanced users. It's for dynamic IP addresses but you could apply the concept to static addresses. It also helps you to find which ports your ISP blocks and which not.

I tried to make it as clear as possible and to work for as many people possible but you might need to improvise (with your experience of course) to make it work, you get the idea :).

First get a DynDNS account like this: http://lifehacker.com/124804/geek-to-live--how-to-assign-a-domain-name-to-your-home-web-server

You need to configure DDNS in your router, put in your username, password and hostname (URL) from dyndns or whatever service you choose. Test it, do a ping to your URL from your home PC (like: ping mycomputer.dyndns.org).

You also need a WakeOnLan (WOL) application like this one: http://www.depicus.com/wake-on-lan/wake-on-lan-gui.aspx so you can turn on the computer remotely.

Then what you need to know is which ports are open by your ISP, to do that disconnect your home router and connect the computer directly to the Internet (I'm using cable modem, you'll probably need to reboot the modem), also disable any firewall (check if your antivirus has a firewall). This is unsafe but just during the configuration steps.

Go here https://www.grc.com/x/ne.dll?bh0bkyd2 click on Proceed and do an "All service ports scan", you need at least TWO open ports, one for magic packets (WOL) and one for the remote desktop application.

Note: If you don't find any open port try doing a more rigurous open port scan, there are programs that do it (like this one: http://portforward.com/help/portcheck.htm), if not then you're out of luck, try calling your ISP to see if they'll open a couple ports for you (not likely if you have dynamic IP ? ). If the open ports are exactly the ones you need then you're in luck... you don't need port forwarding (just port range forwarding, example: from port 5800 to 5800 UDP to the computer's IP, more info ahead).

You can connect the router to the computer now. Don't enable the firewall yet.

Once you know a few open ports (for example 40 and 5000) you need to configure Port Forwarding to your router, for example, the port 5000 is open but your remote desktop application needs port 5800 to work, then you do a port forwarding from port 5000 to port 5800 UDP/TCP (or whatever port it needs) to your computer's IP. Add another Port Forwarding for magic packets (example: from port 40 to port 7 UDP).

Reboot your router just in case it needs to.

Note: You need to know the port number your remote desktop application needs to work. You may also need to add a "Port Range Forwarding" (not to confuse with "Port Forwarding") for example from port 5800 to 5800 (UDP/TCP) to your computer's local IP, (add one for each application you run remotely). Example: Start 5800, End 5800, TCP, 192.168.1.2

Enable WOL in your computer's network adapter or BIOS (check your motherboard's guide). Your computer will probably need a reboot.

Now do a remote WOL. To see if it works go here: http://wakeonlan.me/ put your external IP but with the open port added to it (like this: x.x.x.x:5000, x is the IP of course), the MAC address of your computer (not the router!), and schedule it a minute ahead, then suspend your computer and in a minute it should turn on automatically (you could also use a magic packet sniffer if you don't want to suspend your computer (Here: http://www.depicus.com/wake-on-lan/wake-on-lan-monitor.aspx ).

If all works ok enable the computer's firewall and open the ports in the firewall (the external ones from your ISP, like 40 and 5000). In Windows it's on the advanced firewall settings (make a new inbound rule).

Test everything works ok.

To access your home computer remotely first send a magic packet with the WOL application or send it from an online magic packet website. The advantage of having a WOL application is that it remembers your IP and other configurations.

Then wait a couple minutes so your computer turns on, then access your computer with your remote desktop application (remember to use your home's external IP or the URL from DynDNS).

If you need to know your home external IP from a remote computer just do a ping to your DynDNS URL.

If your ISP changes the open ports you'll need to check again for open ports.

Note: When I say "your computer's IP" I mean the IP you get by typing ipconfig in a cmd window. When I say "external IP" I mean the external IP address of the router (for example when going to: http://whatismyipaddress.com/).

No comments: