Accessing your home computer from the internet

networkingI recently bought a computer to use at home for development. Sometimes I have to access stuff (code, pictures, bittorrent) on my machine when I am away from home. I keep my machine running all the time and recently upgraded my internet connection from 128 kbps to 512 kbps. If you are in Bangalore, India, Airtel offers unlimited bandwidth at 512 kbps for Rs 1499 ($38) a month.

Since I had the essentials in place, I started setting up things to make my machine accessible from anywhere. These are the goals I had in mind.

  1. A domain name – to access my machine without having to remember an ip
  2. ssh access – so I could login and muck around
  3. http access – so I could host a mini-site with photos etcetera

How do I manage with a dynamic ip?

The problem with having an ADSL connection provided by Airtel (and most other internet service providers) is that the ip changes every time you reboot the modem. This is quite a pain even if you can keep your modem turned on all the time. My initial plan was to set up a script on my machine which would ping my website every once in a while to update the ip address. With this I could visit a special page on my website which would list the latest ip address of my home machine.

Dynamic DNS

dyndns.orgI was about to implement this when I came across Dynamic DNS. Dynamic DNS is a mechanism similar in some sense to the one I described above. Basically, your ADSL modem connects to a DNS server every time it gets a new ip and registers it. The DNS server is configured to resolve a domain name to this ip when a DNS request comes in from anywhere on the internet. This is a wonderful solution because most ADSL modems come with this functionality built into the firmware (my Beetel 220BX does too).

To get started, you will have to register an account with one of the Dynamic DNS service providers. DynDns.org, TZO, No-IP are the popular players. You can find a comprehensive listing here. I chose DynDNS.org. After you create an account, goto “Host services” and select “Add new Hostname”. Choose a sub-domain and domain here and click on “Create Host”.

Now you will have to configure your modem/router with this information. Your modem’s web interface will usually be 192.168.0.1 or 192.168.1.1. In case you have a Beetel modem, open IP_ADDRESS/main.html (eg: http://192.168.1.1/main.html). Here choose DNS > Dynamic DNS and fill in the details as shown (username and password are your Dyndns account details). Save the settings and you are done!

You should be able to access the web admin page of your modem using you DynDNS domain name (for me using the domain from my home network does not work for some reason, but I can access from outside).

Getting SSH access working

I am assuming that your computer is directly connected to the ADSL modem. You will have to install an ssh server. I have Ubuntu installed, so I installed OpenSSH server.

sudo apt-get install openssh-server openssh-client

Now that the SSH server is running, you have to allow access to this port through your modem from the internet. By default all incoming connections except 80 and a couple of others are blocked on my modem (as is the case with most modems). You have to tell your modem to allow access to port 22 and also to forward requests coming to your ip at 22 port to port 22 of your computer. Here is how you do it.

First configure the firewall on the model to let through connections to port 22. Goto the web admin page of the modem and navigate to Advanced Setup > Security > IP filtering > Incoming. Click on the “Add” button and set filter name to “ssh” and destination port to 22. “Save/Apply” now.

At this stage, incoming ssh requests are allowed but there is no ssh server available on the modem to handle them, so we must tell it to forward these requests to your computer where the server is setup. Navigate to Advanced Setup > NAT > Virtual Server. Click on “Add” here. Select “Custom server” and type “ssh”. In the server ip address provide the ip address of you computer. You will see a row of input boxes below for port numbers. Fill all the boxes in the first row with 22. For protocol choose “TCP/UDP”. Click “Save/Apply”. You are done. All ssh requests will now be forwarded to the ssh server running on your computer.

modem web admin login
Login box for ADSL modem web admin page

adding host to dyndns account
Adding a host in DynDns.org account

modem dyndns setup
Setting up Dynamic DNS on the modem

SSH port forwarding modem setup
Port forwarding for SSH

Setting up HTTP access

You will need a web server on your computer. If you have Ubuntu, it is straight-forward to set up Apache.

sudo apt-get install apache2

apache
You can customize the web site now by editing files in /var/www. Now you have allow access to the web server from the internet. The issue here is that port 80 which is the default port for http is used by the web admin page for the modem. So we have to settle for some other port. I chose 8080. Follow the steps for ssh (replacing 21 by 8080), but in the port forwarding step, set destination ip to 80 instead of 8080. This should get things working.

You are now on the internet, Baby!

You can now access you machine using ssh at your-sub-domain.dyndns.org and visit you personal webpage at http://your-sub-domain.dyndns.org:8080. Enjoy!

Additional links

on the internet

2 Trackbacks

  1. [...] problem in Port forwarding in Beetel 220BXI ADSL2 modem-router http://i4.tinypic.com/5y2f8ds.jpg This is for receiving websites. Please post your settings. chek theses setting also. http://i6.tinypic.com/6ur7rd3.jpg and have a look on that Accessing your home computer from the internet | Prashanth Ellina [...]

  2. [...] not working in Beetel 220BXI ADSL2 modem-router) see the blog link for detailed instructions. http://blog.prashanthellina.com/2007…-the-internet/ I came to know about this DDNS menu item. in Beetel quite [...]

23 Comments

  1. The only problem with Dynamic DNS is that DNS propagation is a weird thing and doesn’t happen as quickly as you would like it to at times. It should work fine for your scenario but I was struggling with it in connection to Amazon’s EC2 (which doesnt have any static IPs )

    Posted December 11, 2007 at 6:39 pm | Permalink
  2. The cache time for DNS entries in case of Dynamic DNS is usually set to a low number. In my case, it is 60 seconds. I’ve not had any problems so far. What was the cache time you configured?

    Posted December 11, 2007 at 7:58 pm | Permalink
  3. Good Guide! I got tired setting so many steps. so what I had to do was .. grab a software that allows me to access my home computer.. (obviously you need to install the same software again on the other pc.) and had hell loads of issues with them. This guide is simple and good for novice users!

    Stumbled it upon..! May be the people who are looking for such could hunt them down ;)

    Cheers!

    Posted December 16, 2007 at 11:00 am | Permalink
  4. I did this setup because I want to sometimes “push” data into my computer rather than log-in using a software and “pull” data in. Which software are you using?

    Posted December 16, 2007 at 11:33 am | Permalink
  5. Prashanth,

    I was using RA Admin ( http://www.radmin.com/ ) to access my home computer and well you are right… “push” data is something you have been looking out for and I am sure no-ip should have provided a good service. I did try them before sometime..!

    Cheers!

    Posted December 16, 2007 at 6:22 pm | Permalink
  6. Actually I’m using DynDNS, not No-IP.

    Posted December 16, 2007 at 6:31 pm | Permalink
  7. nice tute, :)

    which firmware version are you using . as i can`t find any dynamic dns page at dns

    Posted January 9, 2008 at 11:43 pm | Permalink
  8. Software Version: 3.04L.01.A2pB021c.d16m

    Posted January 10, 2008 at 7:24 am | Permalink
  9. Hello Gaurav, You wil not see the dynamic dns options if you use the bridging option to connect to the internet, it should be a pppoe connection.
    http://192.168.1.1/main.html

    Posted January 11, 2008 at 6:00 pm | Permalink
  10. I see. SO how can i switch from bridged to pppoe mode

    Posted January 11, 2008 at 9:20 pm | Permalink
  11. Xavier

    When I accessed the newly created website from the same machine I was getting the DSL modems web page…
    So access the site via a proxy site to verify whether it works…..

    Posted April 18, 2008 at 8:47 pm | Permalink
  12. Thanks for the tip Xavier. I did the same thing to verify that my connection was working.

    Posted April 23, 2008 at 6:21 pm | Permalink
  13. Jay

    Hello,

    Thanks for this guide, however, I have been unable to get the damned thing working. The worst part was, I once got it to work, and it no longer does. I wanted to use port 9000 on the external to fwd to ssh at home. My setup is as follows:

    IP Filtering>Incoming> Dest Port = 22
    Virtual Servers>
    External:22-22 Internal 22-22

    I still can’t get it to work. Strangely I can get my bittorrent clients to complete a loop using port 6881 etc.

    Any ideas?

    Jay

    Posted June 4, 2008 at 10:43 pm | Permalink
  14. i am not able to find dynamic dns option.please help me…

    Posted June 26, 2008 at 5:18 pm | Permalink
  15. Jay. Nope I don’t know what is wrong. Did you get it to work? If yes, please post. Vamsi, check out Kalyan’s comment above (to Gaurav).

    Posted July 28, 2008 at 7:42 pm | Permalink
  16. Pal

    hi my problem is when i type my dyndns address the router page (ut star wa3002g4 mtnl delhi) pops up!

    whats to be done here ??

    Posted August 17, 2008 at 5:02 pm | Permalink
  17. Irus

    “You can customize the web site now by editing files in /var/www. Now you have allow access to the web server from the internet. The issue here is that port 80 which is the default port for http is used by the web admin page for the modem. So we have to settle for some other port. I chose 8080. Follow the steps for ssh (replacing 21 by 8080), but in the port forwarding step, set destination ip to 80 instead of 8080. This should get things working.”

    can you elaborate this with screenshots im having this problem!!

    Posted August 18, 2008 at 1:14 am | Permalink
  18. Pal

    actually my modem doesnt have an option of destination ip in NAT, it only has start port and end port, ip address and service. what to do? the router page keeps popping up

    Posted August 18, 2008 at 1:22 am | Permalink
  19. Pal

    ok i found the ipfilter settings but it is asking for a lot more than destination port. it wants source ip/port/subnet masks as well…. my apache server is listening on port 80 so let me know whats up!!>?? thnx!

    Posted August 18, 2008 at 3:29 am | Permalink
  20. Pal
    Posted August 18, 2008 at 4:22 am | Permalink
  21. Ramesh Bende

    Hi,
    Can u tell me the about relaiblity of dyndns.com?(Downtime and service if i go got my own domain)
    If i have wireless net coneection, then how should i configure the dynamic dns in that case? Do u have any idea about it.

    Posted September 19, 2008 at 2:01 pm | Permalink
  22. Arun

    Nice writeup.

    Sometimes, I do need to access my home machine to get to some much needed files.

    I have IIS on my WinXP machine. Do I still need to use an ssh server?

    Posted October 2, 2008 at 8:41 pm | Permalink
  23. Anil

    Hi Guys,

    We are looking for DYN DNS Service Providers in India. Can any1 help me to get their contact nos. plz.

    ANil

    Posted November 20, 2008 at 4:49 pm | Permalink