Dynamic DNS

Dynamic DNS is the practice of automatically updating DNS records in response to a frequently-changing, or "dynamic" IP address.

Typically, DNS records point to servers with an infrequently-changing, or "static" IP, or one which changes under the control of the server's administrator. In this situation the DNS records and IP addresses are easily synchronized. However, there are many situations where an administrator does not have control of the IP address of their server. Such is the case when a residential subscriber to a ISP wishes to run a server at home. In this situation, a script may be used to automatically update DNS records. This scripted update process is called "Dynamic DNS."

In practice, a Dynamic DNS script allows a Dreamhost user to use http://mydomain.com to access their Dreamhost-hosted website, and use a subdomain like http://home.mydomain.com to access the webserver running on their cable modem-connected computer. Dynamic DNS makes it easy to "ssh home" when away, or to tell your friends the address of your network video game, without having to remember an IP address.

Dynamic DNS via local shell script
A 'sh' script utility can be found here. This script should run on any UNIX type operating system with a standard /bin/sh and wget installed.

Dynamic DNS via local perl script
A perl script utility can be found here. This script should run on any modern operating system with perl installed. It runs in the background, and can automatically update a DNS record on a configurable schedule.

Dynamic DNS via your web server
An example dyndns implementation using the Dreamhost API can be found here.

To use it, wget -O dyndns.php "http://smoser.brickies.net/git/?p=dreamhost-tools.git;a=blob_plain;f=dh-dyndns.php" chmod go-rwx dyndns.php vi dyndns.php base_url="${your_url_location}/dyndns.php" pass="your_pass" # password matching PASSWD above ip="192.168.1.1" # update addr, or leave empty to have the server grab the clients address host="myhost.example.com" # whatever host you want to update record for
 * create a dreamhost key that can access dns-* methods in your account
 * download the php to somewhere on your dreamhost web space:
 * 1) edit '$DH_API_KEY', setting the value to the key given to you above
 * 2) edit '$HOSTS' to limit it to only the dns entries you wish to allow modification to
 * 3) edit '$PASSWD' to protect this page
 * Now, from any web browser or client, you can simply make a request to the server:

wget "${base_url}?host=${host}&passwd=${pass}&ip=${ip}"

There are surely improvements that can be made to the above. If you have ideas (or patches), please send to smoser @ no-spam-me @ brickies dot net

Alternative PHP script
An alternative set of scripts (including documentation) with some additional options and settings can be found here: https://github.com/joekrill/dreamhost-dynamic-dns

Dynamic DNS via Windows Service
A small, working .NET Windows Service is at https://github.com/mattgwagner/Dreamhost-Dynamic-DNS-Updater for use to update a hostname with your local IP address. The update interval can be configured.

Turnaround time for updates
It may take up to 4 hours for computers on the Internet to notice that your DNS information has changed. If this is unsatisfactory, another way to enable Dynamic DNS on your Dreamhost-controlled subdomain is to point it at a Dynamic DNS service.

The default TTL for records at Dreamhost's DNS servers is 14400 seconds (4 hours). Records cached by DNS servers that already have the entry cached would take up to 4 hours to get updated. If your IP changes faster than this, you can create a fixed CNAME record for your domain at Dreamhost, pointing to a free dynamic dns domain. For example, suppose that you have a free account at No-Ip.com and you have the dynamic hostname yourname.no-ip.org (that has a TTL of 60 seconds). At Dreamhost's webpanel, you create a static CNAME record yourname.yourdomain-at-dreamhost.com ("static"  because it's not frequently updated) that points to yourname.no-ip.org (dynamic, TTL 60s). Then you update just yourname.no-ip.org, using their dynamic DNS update client.

Subdomains
If you have a domain like example.net, and want to have a subdomain like home.example.net, the DNS of which must be controlled by a server which is not Dreamhost's, you can simply delegate that subdomain to a different server by creating a NS record. The NS record must use a hostname (not an IP address) of the target DNS server, and if that server is not officially registered as such, you can add an auxiliar type A record with its FQDN and IP.

This can be used as an alternative for the above dynamic DNS script - one can simply run a DNS server at home, and make home.example.net use that server instead of updating dreamhost's all the time.