- About Us
The crux of the issue is that the domain name system was created with fixed name-to-IP mapping in mind, back in the mid 1980s. IP addresses were static, so the mappings between host names and IP addresses were static, too. But the early 1990s saw the rise of dynamically assigned IP addresses, thanks to protocols like DHCP. Thus some IP addresses were constantly coming and going, but the nameserver records were not being refreshed to reflect the changes.
Luckily, the Internet Engineering Task Force (IETF) worked out a solution. RFC 2136 added a new UPDATE opcode with which administrators could dynamically push revisions to nameservers.
Before too long, a whole industry sprang up around the idea of hosting DNS records for computers plagued by dynamic IP addresses. That includes most of us on home broadband connections. Cable and DSL companies expect their customers to use their connection one-way: to surf the Web and download email (and of course the occasional file). For these connections, a dynamic IP address is fine -- you initiate the HTTP requests.
But if another computer needs to initiate a connection to your home PC, the other computer needs to have your PC's IP address to send the request. This would happen if you were running a Web server on your home PC (a hobby not all ISPs are thrilled about), or if you want to initiate SSH or VPN sessions from the road. Your ISP gives you an IP address from its private pool, but that address can change regularly (with every DHCP renewal) and unexpectedly (such as following a service outage). If the ISP gives you a hostname, it is usually awkward, like dsl1234.south.mo.fastsamsdiscountbroadband.com, and is just as likely to change as the IP address.
The host with the most
The solution is to choose your own hostname for your PC, set up a record for it with a dynamic DNS service provider, and set up your PC to check its own IP address regularly and send an update message to the dynamic DNS server when it changes. Then you can SSH to myhost.unclenatesdomain.org and be assured it will reach your PC.
Choosing which dynamic DNS provider to go with can be as confusing as picking a Web hosting provider -- there are so many out there, it is impossible to to research them all responsibly. Google's directory lists more than 50, and it only includes English-language services. As you go shopping, here are a few things to look for:
Before leaving the question of choosing a dynamic DNS service, there are a few other avenues to consider. First, if you pay for a Web hosting service already, check to see if they offer a dynamic DNS service as well. More and more do, since it costs them little extra in terms of administrative overhead.
Second, an increasing number of broadband routers ship with some manner of built-in support for dynamic DNS service. My Linksys WRT router, for instance, supports two popular dynamic DNS services (DynDNS.com and TZO.com) right in the firmware. Setting it up is menu-driven, and you may get NAT redirection handled at the same time.
Update clients and what they do
To set up your Linux PC to work with a dynamic DNS service, it is best to follow your provider's directions. The general idea is the same for all providers, though; you download and install a script from your provider. This may be a custom script or one of several third-party scripts.
One of the most popular scripts seems to be ddclient, which is even included in many modern Linux distributions. Ddclient began as a tool specific to DynDNS.com's service, but has now expanded to support multiple dynamic DNS providers and niceties such as working with the dynamic DNS hardware routers mentioned above.
Ddclient reads its configuration from /etc/ddclient.conf. In this file you specify which service provider you are using and your account details for that service. Ddclient checks for changes to the local IP address upon several circumstances: on system startup, upon renewal of a local DHCP lease, upon initialization of a PPP session, and at regular intervals during normal system operation.
When configuring your system for a dynamic DNS service, remember that you are treading through territory also covered by firewall and NAT issues, and that means that problems could be difficult to troubleshoot. If you find yourself stuck, the easiest approach is to ignore the dynamic DNS service first, and make sure that you have NAT and firewalling set up correctly -- you can do this by attempting to connect to your PC by its IP address -- which is ironic, if you stop to think about it. Most of the time a problem is not with the dynamic DNS service at all. Once you know that your firewall and NAT redirection are set up correctly, you can test your dynamic DNS entry with an Web-based lookup tool or the nslookup command. Don't rely on ping, though -- for security reasons many ISPs simply drop ping packets with generating a reply.
That is all it takes to get started. One final thought: the great thing about dynamic DNS is how fast it updates. If you signed up for an account at one of the free dynamic DNS providers when you started reading this article, you'd be connecting to your home PC remotely already.