edoceo

eNom Dynamic DNS Script

The edoceo.com/pub/enom-ddns.sh script is a Dynamic DNS update utility for use with the registrar eNom. We have scripts written in Bash, PERL and PHP. With their Dynamic DNS it's possible to create names under your domain that are on a dynamic IP address, awesome.

If your office is on a dynamic IP address, as some broadband providers do, this script could be run from some host in there to keep office.yourdomain.com pointed to the office internet connection. Then your VPN clients and other allowed traffic can point to the constant name, not the ever changing IP address. The Curo Small Business Server, which provides VPN remote access servies, uses Bash version of this tool.

To use setup a cron job (or however your system schedules tasks) to run this script every five minutes. Five minutes is the suggested value by eNom, but in our experience once an hour was acceptable. Adjust the paths for where ever this script was saved, the PEAR::HTTP_Request package is also needed, refer to your system or PHP documentation.

# fcron
@ 5 /opt/edoceo/bin/enom-ddns.sh

# dcron/vixie-cron
*/5 * * * * /opt/edoceo/bin/enom-ddns.sh

Bash Script

This script depends on having Perl's URI::Encode module.

#!/bin/bash
# $Id$
# spec: enomddu.sh - eNom Dynamic DNS Update with Bash

hostname=$(/usr/bin/hostname)
password='password'
zonename='example.com'

# Must have the PERL module URI::Escape
url_hostname=$(echo $hostname | perl -MURI::Escape -lne 'print uri_escape($_)')
url_password=$(echo $password | perl -MURI::Escape -lne 'print uri_escape($_)')
url_zonename=$(echo $zonename | perl -MURI::Escape -lne 'print uri_escape($_)')

enom_url='http://dynamic.name-services.com/interface.asp?Command=SetDNSHost'
enom_url="${enom_url}&HostName=${url_hostname}"
enom_url="${enom_url}&DomainPassword=${url_password}"
enom_url="${enom_url}&Zone=${url_zonename}"

curl $enom_url > /dev/null

This can also be downloaded from edoceo.com/pub/enom-ddns.sh.

Change Log

  • 2012w13 - Renamed to enom-ddns
  • 2007-05-30 - Finally added the Bash and Perl versions. /djb
  • 2006-01-04 - Published, /djb

Loading Comments from Disqus...