Thursday, March 13, 2014

How to setup DDNS (Dynamic DNS) on a Cisco IOS router

Created by Gary in 8/12/2012 9:10:28 AM
How to setup DDNS on your Cisco IOS router that actually works!

Normally we try to setup static IP addresses for our managed routers. However in this case the router was residential and in Singapore. Getting a static IP address was actually impossible.
I started the project by researching DDNS providers. Many of the DDNS providers that were free in the pase are no-longer free. However still offers a free version of DDNS. The free version is under the section of their website for personal. At this time I could not find any statements on their site restricting the service to personal use. Here is a link to their site.
This procedure is easy to perform but due to lack of proper documentation and a lot of incorrect documentation, including that in the knowledgebase, it is more difficult than it should be.
This article assumes you have a basic knowledge of Cisco routers and know how to get into config mode and how to save your configuration.
There are three primary steps to setting up DDNS on a Cisco IOS router.
  1. Setup and confirm DNS resolution works.
  2. Setup  a DDNS method to be called.
  3. Setup the external DHCP interface to call the DDNS update method.

Setup DNS resolution.

Confirm your router can ping something by name properly. A simple 'ping' is an effective test. If it does not work you can setup you router DNS to use Google's public DNS servers with these two config lines:
  • ip dns server
  • ip name-server

Setup the DDNS method.

The method tells the router how to contact the DDNS provider, login and send the proper update command. It also controls the minimum and maximum time between DDNS updates. Do not set the maximum time too short. Many DDNS providers will lock you out if you update too frequently. I typically use one day but you need to check with your provider.
Create and name the DDNS update method.
  • ip ddns update method ddns-noip
Set the update mode to HTTP
  • HTTP
Create the ADD URL. The URL contains some special characters mainly the'?' that is problematic to enter because the router interprets it as a call for help. Use CTRL-V just before typing the '?' and the router will place it properly. Replace [username] and password with your no-ip credentials. You will need to enter your username as an email address including the '@' 
<h>&myip=<a> is a macro replaced by the router during the update with hostname and ip. i.e.'
  • add http://[username]:[Password]<h>&myip=<a>
update minimum every 5 minutes maximum 1 day.
  • interval maximum 1 0 0 0
  • interval minimum 0 0 5 0

 Apply the update to the external DHCP interface.

Select the external interface and apply the update command to call the method you just created. For the Cisco 871 router used in this configuration it is FastEthernet 4. Replace it with your proper interface. For PPPoE it is likely interface Dialer 0.
Substitute your DDNS method name and the hostname to update at your DDNS provider with your specific details..
  • interface FastEthernet4
  • ip ddns update hostname [DDNS hostname]
  • ip ddns update ddns-noip


Unfortunately I have not figured out a way to force a DDNS update NOW. What you can do is set your maximum update time short like 5 minutes. Turn on debugging with: debug ip ddns update. You will get some very useful debug information. Make sure all the parameters are correct on the calls.
You may need to reload your router. I have round that changing the add command did not update properly after some changes until after a reload.

Sample Debugging Output for a working update.

*Aug 00 00:00:55.433 EDT: DYNDNSUPD: Adding DNS mapping for <=>
*Aug 00 00:00:55.433 EDT: HTTPDNS: Update add called for <=>
*Aug 00 00:00:55.433 EDT: HTTPDNSUPD: Session ID = 0x7
*Aug 00 00:00:55.433 EDT: HTTPDNSUPD: URL = 'http://[email protected]:[email protected]/nic/update?'
*Aug 00 00:00:55.433 EDT: HTTPDNSUPD: Sending request
*Aug 00 00:00:56.441 EDT: HTTPDNSUPD: Response for update <=>
*Aug 00 00:00:56.441 EDT: HTTPDNSUPD: DATA START nochg
*Aug 00 00:00:56.445 EDT: HTTPDNSUPD: DATA END, Status is Response data recieved, successfully
*Aug 00 00:00:56.445 EDT: HTTPDNSUPD: Call returned SUCCESS, update of <=> succeeded
*Aug 00 00:00:56.445 EDT: DYNDNSUPD: Another update completed (outstanding=0, total=0)
*Aug 00 00:00:56.445 EDT: HTTPDNSUPD: Clearing all session 7 info

No comments:

YouTube Channel