Dynamic DNS

By David Efflandt


For anyone to connect to your computer from the internet, they first need to find your IP address. I will not go into details here, but properly configured nameservers allow you have a name that points to your internet IP address from anywhere in the world. Note that this document does not detail reverse name lookup (finding a name for your IP), which usually requires cooperation of your ISP, and is unlikely for dynamic IP.

One thing that may interfere with your plans is if your ISP blocks certain ports for your (actually their) protection. For example, many block outgoing port 25 other than to their own smtp servers. And some, like MSN use proprietary authentication which may make sending mail impossible except through them with their client (although webmail works). Others block incoming port 80 to minimize MS IIS webserver exploits (worms) and keep you from running a webserver. So you should test the ports you expect to use before going any farther. Although, you can configure a webserver for a different port if you don't mind including the port in the URL.

If you have a static IP, the nameserver records do not change very often, the DNS is cached by local servers and changes may take several days to propegate around the internet. If you have a dynamic IP, you need a DNS hosting service that can update their records much more promptly when your IP changes (however seldom). There are many to choose from if you do a web search for dns hosting.

You will need a client script or program that will tell the DNS hosting service when your IP changes, or that runs periodically if you do not know. Make sure that the service you are considering supports your operating system, or at least has 3rd party client scripts or programs available. You may need to download the script or program to see how it works.

I stumbled across www.no-ip.com which provides free subdomain names, or can do DNS for your own domain(s) for a nominal fee. I signed up and registered a couple of subdomains to experiment with virtual webhosting. My names always immediately resolve to my IP as soon as I connect.

The easiest way to get everything working is to assign your new hostname.domain to your computer. So your computer can find itself by that name when you are not connected, you may want to assign it to a local network interface, or if none, to an extra loopback IP like 127.0.0.2 in /etc/hosts. Windows users are on your own, but you can usually set your hostname and domain in Network settings for TCP/IP, or names for IP's in \windows\hosts (hosts.sam is just an example).

Then you need to set up your DNS client for the name hosting service so it can tell the nameservers when your IP has changed. I was using pppoe for adsl, so I simply added a line in my /etc/ppp/ip-up.local script to run the noip client program once whenever I connect (use a full path to the script or program). I am not familiar with dhcp, but it likely runs some sort script when its IP changes that you can hook into.

I am now behind a D-Link DI-704 broadband gateway and wrote a Perl script to monitor my internet IP from slightly modified firmware, which can then update DNS automatically if my IP changes [ details ]. If you are behind a firewall/router/nat/proxy and do not have any way to monitor your internet IP, you may need to configure your client so it runs at regular intervals and updates based on the internet IP the request comes from.

If all else fails, you can typically manually update your IP from a web interface.

Then go through the configuration and restart of any servers you are running to make sure that they recognize that name. I will not go into detail about various smtp servers, but if you can telnet localhost 25 and get a response with your newly acquired FQDN (fully qualified hostname with domain) you should be set to send mail. The only snag could be if your reverse lookup name/IP is rejected due to spam history. Just make sure that your mail server is actually running and listening to port 25 on any IP, is not blocked by firewall or hosts.allow/hosts.deny, and is set to accept mail for your hostnames/domains (test it from outside).

Related Files:


Dynamic DNS
for your domain [ Local Home | Internet Home ]