Monday, February 09, 2009

Port Forwarding : Accessing your home computer from work

In order to access the home ubuntu desktop from work, following is what i needed to do:
  1. Installed open-ssh demon on ubuntu with: sudo apt-get install open-ssh
  2. Tested that i could use a windows box on the home lan to access the sshd using putty.
  3. Once sshd is setup, followed the instructions at http://www.portforward.com/help/pfprogression.htm, which is broadly the following:
  • First we need to setup static/manual IP on the host computer to which we want to forward the port(s) to. Mine was setup to obtain IP address using DHCP so i first changed that to manual.
  • Then login to the router (mine is an Air-link AR670W) and enable Port Forwarding for the SSH application port 22 for both TCP/UDP protocols and provided the static IP of my ubuntu desktop.
  • Saved the configuration and router reboots after that.


Then i noted down the ISP assigned public IP to my router's external interface and used that IP (external IP of my router) from a windows box to putty to. Since the SSH port 22 on router is configured to be forwarded to my ubuntu desktop, so i was allowed my way to the ubuntu desktop.

http://www.portforward.com/routers.htm has a listing of several routers and the documentation on how to configure that router for port forwarding.

Also checkout how to setup a easy to remember domain name for your router so that you dont have to remember your router IP (http://www.techthrob.com/tech/dyndns.php). This way even if your router is assigned a new external IP by your ISP, the ddclient demon will automatically update the mapping of your domain id to the new IP. The dyndns.com site has a script generator which can generate the ddclient.conf file for you. Use the generator and it will work without fail. You can find it here.

To configure ubuntu 8.10 for static IP, just use the System > Preferences > Network Configuration UI and select Manual for Method in IPv4 Settings tab and provide your static IP address (say 192.168.1.100), the netmask and the gateway (router ip - like 192.168.1.1). Also you may provide DNS servers (check your router's status page for knowing what DNS servers to use - it will automatically have got it from your ISP).

No comments: