This article is for those who wish to host a web service on their home computer, but are stuck with a dynamic IP.
For starters, dynamic IP is one that is not permanent and keeps changes usually after a modem reboot. Static IP are the ones that are assigned by your ISP and they never change, but usually ISPs charge a premium for that.
If you have a static IP, you can associate that IP to your domain name in the DNS records and people can reach your web service either through the domain name or through the IP. It is as simple as that.
But with a dynamic IP address, where the IP associated to your computer keeps changing, it is difficult to maintain the DNS records up to date with the new IP address every time the address changes. And since it is not static IP, people will not be able to reach the server through IP either. What we need here is a mechanism to automatically update the DNS records whenever the IP address changes on your computer so that your domain name always maps to the latest IP address. This ‘mechanism’ is called Dynamic DNS or DDNS service. Many companies provide this service, some for free and some charge for this service. For a complete list of DDNS provides, see http://dnslookup.me/dynamic-dns/. They typically provide a client that needs to be downloaded to your computer and it needs to be run like a cron job. This program keeps an eye on the IP address change, and as soon as the address changes, it updates the server, which in turn updates the DNS records.
We also need to take care of one more issue when the computer is behind a router. Router assigns a private IP address to your computer, something like 192.168.x.x and this private address not reachable from the external network. We need to configure ‘port forwarding’ on the router so that the router forwards all the http requests received on a particular configured port on your external IP to a configure port on your machine where web service is running. Note that, we need to configure the computer to have static private IP address, say 192.168.1.99, so that this IP address can be used as destination IP in the router ‘port forwarding’ configuration.
- Get a domain name for a domain name provider for yourself
- Register with a DDNS provider like dynDNS or no-ip or zoneedit, download and install the client that he provides.
- Configure ‘port forwarding’ on your router.