The DDNS aka Dynamic DNS is an old feature that several routers (non only Cisco devices) have implemented and, in some circumstances, it is very useful.
DDNS is a method of automatically updating a name server in the Domain Name System (DNS), often in real time, with the active DDNS configuration of its configured hostnames, addresses or other information. It provides two mechanisms to generate or perform DDNS: the IETF standard as defined by RFC 2136 and a generic HTTP using various DNS services.
In a nutshell, when this feature can simplify our lifes? When we haven’t a static IP public address (ADSL or other technologies…)!
Suppose that we would manage our router around the world but we have only a dynamic public ip address; how can we do that? The answer is DDNS :)
It is very simple implement this feature in Cisco devices:
1. Register to a DDNS services; there are several alternatives. In this article I use the no-ip services (it is free!).
2. Configure Cisco devices.
2a. Configure the DDNS credentials:
ip ddns update method myupdate HTTP add http://username:firstname.lastname@example.org/nic/update?hostname=<h>&myip=<a> remove http://username:email@example.com/nic/update?hostname=<h>&myip=<a> interval maximum 0 0 5 0
Where username and password are our credentials and the “interval maximum 0 0 5 0” defines how often update the dns entry.
Remember: The question mark “?” is a special character, so you need to escape it! To do it press “CTRL + V”, then “?”.
Note: As you can see, the https link has two special tag: <h> and <a>. These variables are dynamically substituted with the hostname and the ip address of the interface, during the HTTP query!
2b. Apply the DDNS template to the interface (in this case the Dialer1):
Interface Dialer1 ip ddns update hostname ciscozine.ddns.net ip ddns update myupdate
The first entry defines the hostname, while the second entry link the template defined in the point “2a” to the interface.
To better understand how the DDNS works, below the log messages after enabling the “debug ip ddns“.
Nov 23 21:05:21.688: DYNDNSUPD: Adding DNS mapping for ciscozine.ddns.net <=> 184.108.40.206 Nov 23 21:05:21.688: HTTPDNS: Update add called for ciscozine.ddns.net <=> 220.127.116.11 Nov 23 21:05:21.688: HTTPDNSUPD: Session ID = 0x4C Nov 23 21:05:21.688: HTTPDNSUPD: URL = 'http://ciscozine:firstname.lastname@example.org/nic/update?hostname=ciscozine.ddns.net&myip=18.104.22.168' Nov 23 21:05:21.688: HTTPDNSUPD: Sending request Nov 23 21:05:22.444: HTTPDNSUPD: Response for update ciscozine.ddns.net <=> 22.214.171.124 Nov 23 21:05:22.444: HTTPDNSUPD: DATA START nochg 126.96.36.199 Nov 23 21:05:22.448: HTTPDNSUPD: DATA END, Status is Response data recieved, successfully Nov 23 21:05:22.448: HTTPDNSUPD: Call returned SUCCESS, update of ciscozine.ddns.net <=> 188.8.131.52 succeeded Nov 23 21:05:22.448: DYNDNSUPD: Another update completed (outstanding=0, total=0) Nov 23 21:05:22.448: HTTPDNSUPD: Clearing all session 76 info
Now it is enough remember the hostname “ciscozine.ddns.net” to log in the router (via SSH, HTTPS, …).