Ever-changing IP addresses are an annoyance but you can clear up your remote connectivity static with Dynamic DNS services.
If you need to connect to your home or small office systems from remote locations, but can’t because your wonderful ISP changes your router’s IP address regularly; there is an answer: Dynamic DNS services such as those provided by DynDNS.com. Dynamic DNS services supply you with static Internet-accessible hostnames that dynamically attaches to your elusive and dynamic IP address.
The concept is simple. You create an account on DynDNS.com, name your host, select a domain (Yes, you have a choice of several domains), install the client software and enjoy your new service.
Setup DynDNS.com Account
Creating your service is easy to do but a little time-consuming (One to two hours) but the end result is well worth your time. If you’re ready to begin, open a browser and point it to the Dynamic DNS Free page and click the large Create Hostname button. Here, you’ll enter the hostname you want to use when you connect to your remote systems, select your domain from the dropdown list, choose the service type, enter your current IP address (your detected IP address appears on the page for you), select mail routing and pick the list of services you’d like to use. Click the Add to Cart (Don’t worry about this, the service is free.) button when finished.
On the next page, you’ll see that your balance due is $0.00. You can sign up for enhanced services by upgrading to Dynamic DNS Pro at the rate of $15.00 per year. To continue with the free service, enter your desired username, password, email address and create your account. Check your email account, that you entered when you created your DynDNS.com account, for a confirming email message. Click on the provided link to complete the account creation process.
Finally, login to your account to verify that your account is correct and that your configured host exists.
To setup your home or office system that will handle updating the DynDNS.com service, you have to install the client software on your Linux system. Once you initiate installation, a wizard steps you through the process.
On Debian-based systems, enter the following apt-getcommand and let the magic happen.
sudo apt-get install ddclient
[sudo] password for khess: **********
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libio-socket-ssl-perl libnet-libidn-perl libnet-ssleay-perl
The following NEW packages will be installed:
ddclient libio-socket-ssl-perl libnet-libidn-perl libnet-ssleay-perl
0 upgraded, 4 newly installed, 0 to remove and 14 not upgraded.
Need to get 365kB of archives.
After this operation, 1,716kB of additional disk space will be used.
Do you want to continue [Y/n]? y
The following ddclient screenshots illustrate the graphical setup wizard.
Figure 1 prompts you to select the dynamic DNS service you’ve chosen. For this demonstration, select www.dyndns.com and continue.
Figure 1: Select Your Dynamic DNS Service
Enter the name of the hostname and domain that you setup in the account creation step (Figure 2).
Figure 2: Enter Your Hostname (FQDN)
Enter your DynDNS.com account username in the next screen, as shown in Figure 3.
Figure 3: Enter Your Account Username
Enter your DynDNS.com account password and continue (Figure 4).
Figure 4: Enter Your Account Password
And, as shown in Figure 5, enter the applicable interface for this service.
The wizard writes this information to /etc/ddclient.conf or to /etc/ddclient/ddclient.conf (Distribution dependent).
Figure 5: Enter The Service Interface
For those of you who manage systems that don’t have ddclient in your repositories, or for those that install it but don’t walk you through the setup, download ddclient from DynDNS.com.
sudo cp ddclient /usr/sbin/
sudo mkdir /etc/ddclient
sudo cp sample-etc_ddclient.conf /etc/ddclient/ddclient.conf
sudo vi /etc/ddclient/ddclient.conf
Edit the /etc/ddclient/ddclient.conf file and change the hostname, username, and password to match your account settings.
$ sudo cp sample-etc_rc.d_init.d_ddclient /etc/init.d/ddclient
sudo /sbin/chkconfig --add ddclient
After you finish the setup, you might have to start or restart ddclient, if it’s running.
$ sudo /etc/init.d/ddclient start
$ sudo /etc/init.d/ddclient restart
Your installation, if successful, should offer no messages to standard output but should log all messages to /var/log/syslog. See the successful entry below.
Sep 1 07:52:39 debian5-1 ddclient: SUCCESS: updating kenhess.homelinux.com: good: IP address set to 192.168.1.77
The IP address shown is invalid. Yours should show your external router IP address. To check your update status, login to your DynDNS.com account and view your host(s) and verify that entry against the syslog information.
To use your new service, you’ll have to allow your chosen protocols through your firewall. Since there are too many types of firewalls, this part of the setup presentation is generic. Refer to the Port Forward guide for DynDNS.com, if you have problems.
Login to your firewall or router with administrative privileges. Navigate to the Port Forwarding section of the interface. For example, if you want to connect to your Linux system via SSH, create a new rule for that system. Add port 22 and enter the IP address of your system. Additionally, you might have to name this rule. Save the configuration.
From a computer outside your network, attempt a connection to your Linux system. Use the hostname that you setup on DynDNS.com as your target. If you setup your firewall correctly, you should connect as if you were on the same network.
$ ssh your_host.your_domain.com
login as: username
username@your_host.your_domain.com's password: *******
Your ddclient daemon will attempt to update every five minutes to keep your dynamic DNS hostname pointing to your ever-changing IP address.
Before I discovered DynDNS.com, I used several workarounds to connect to my home systems from remote networks. It’s both frustrating and time-consuming to hit a moving target, which I suppose is why ISPs periodically expire your IP address. They also want to make sure you don’t run any mail or web services unless you pay a premium price to allow those protocols through to your connection. Dynamic DNS services don’t solve the problem of blocked protocols but it does make it easier to connect via the allowed ones.