Thursday, September 16, 2010

Dynamic DNS on IOS


One of the challenges in getting the community lab up and running was not having a reliable static IP address for public reachability (the lab is connected to the Internet via a home cable broadband connection for the time being). Rather than shell out an absurd amount of cash for a "business" plan with a static IP, I opted to make use of Dynamic DNS (DDNS).
For those unfamiliar with DDNS, it works like this:
  1. Register an account with a free or paid DDNS provider.
  2. Configure your CPE router (or workstation) to act as a DDNS client.
  3. A unique domain name is created by the DDNS provider, pointing to your current IP address.
  4. Whenever your router receives a new IP address from your ISP, the DDNS client notifies the DDNS server and your DNS record is updated with the new address.
Many SOHO network devices (Linksys, Netgear, etc.) ship with support for several popular DDNS providers. Cisco IOS also supports DDNS client capabilities. This article describes the configuration of DDNS as offered by DynDNS.com, but it can be adapted to suit any provider which supports updates via HTTP requests.
Configuring my Cisco 1811 demarcation router to work with DynDNS was pretty straightforward. (This example assumes DHCP has already been configured on the ISP-facing interface.) The first step is to define a DDNS update method:
Router(config)# ip ddns update method DynDNS
Router(DDNS-update-method)# ?
Dynamic DNS update method configuration commands:
  DDNS      IETF standardized Dynamic DNS update
  HTTP      Dynamic DNS update via HTTP based protocols
  default   Set a command to its defaults
  exit      Exit from DNS dynamic update method configuration mode
  internal  Update internal IOS name cache
  interval  Specify interval between DNS updates
  no        Negate a command or set its defaults
DynDNS in the example above is an arbitrary unique name; this can be anything you want. Two update methods are available: IETF (defined in RFC 2136) and HTTP; most free providers seem to support HTTP updates, and that is the method used in this example.
Under the HTTP method configuration, specify the URI the router will use to contact the DDNS provider with a new IP address when a change occurs. (The URI shown here is valid only for DynDNS.)
Router(DDNS-update-method)# http
Router(DDNS-HTTP)# add http://username:password@members.dyndns.org/nic/update
 system=dyndns&hostname=<h>&myip=<a>
Note the two letters encased in angled brackets within the URI, <h> and <a>. These two special strings will be replaced with the router's hostname and interface IP address, respectively, when the HTTP request is made. Note that you'll need to insert a ctrl-v immediately before the question mark in the URI to escape the character and avoid invoking context-sensitive help. Also note that the URI will typically include the login credentials of your DDNS account and as such should be treated as sensitive.
It may be a good idea (depending on your provider's terms of service) to configure a minimum update interval. This will force the router to issue a DDNS update request even when the address has not changed, so that the service provider knows that the account is still active. The interval is specified with four integers: days, hours, minutes, and seconds. The line below configures a minimum update interval of 24 days.
Router(DDNS-update-method)# interval minimum 24 0 0 0
The last item to configure is the ISP-facing interface. At a minimum, you'll simply need to apply the DDNS update method name to the interface. You'll probably also want to set an explicit hostname to be used for DDNS updates, instead of your router's actual hostname:
Router(config)# interface f0
Router(config-if)# ip ddns update hostname myname.dysndns.org
Router(config-if)# ip ddns update DynDNS
debug ip ddns update can be used to watch DDNS updates take place when the interface acquires or reacquires an IP address.

1 comment:

  1. The product, according to the brand, can be applied throughout the day on dry
    hair if one's hair is medium to very coarse. Since these goods are made from plant extracts, seed oils and hair only twice in a week. The professional hair merchandise of Loreal are effectively currently being sold all more than the world in about one hundred thirty different countries.

    My web blog; hair products

    ReplyDelete