Dynamic DNS

POSSIBLE OUTDATED INFORMATION!
The information on this page may not function or work as intended. DreamHost support is unable to assist with any customizations. Use at your own risk!

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 (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://example.com to access their DreamHost-hosted website and use a subdomain like http://home.example.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.

DreamHost DNS Update Script using the DreamHost API

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:

  • create a DreamHost key that can access dns-* methods in your account
  • download the PHP file to somewhere on your DreamHost web space:
[server]$ wget -O dyndns.php "http://smoser.brickies.net/git/?p=dreamhost-tools.git;a=blob_plain;f=dh-dyndns.php"
[server]$ chmod go-rwx dyndns.php
[server]$ vi dyndns.php
# edit '$DH_API_KEY', setting the value to the key given to you above
# edit '$HOSTS' to limit it to only the dns entries you wish to allow modification to
# edit '$PASSWD' to protect this page
  • Now, from any web browser or client, you can simply make a request to the server:
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

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

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

Python script to update DNS Records

Code and complete instructions for installation on DreamHost at Python Dynamic DNS Update Tool. You should be comfortable working in an SSH shell. There are a couple of Python tools, including one which detects & updates IPv6 addresses.

Dynamic DNS via Windows Service

A small .NET Windows Service used to update a hostname with your IP address can be found at https://github.com/mattgwagner/Dreamhost-Dynamic-DNS-Updater. 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.example.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 (where DNS  must be controlled by a server that is not DreamHost's), you can simply delegate that subdomain to a different server by creating a Nameserver record. The Nameserver record must use a hostname (not an IP address) of the target DNS server. If that server is not officially registered as such, you can add an auxiliary 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.

See also

Did this article answer your questions?

Article last updated .