Dynamic DNS

From DD-WRT Wiki

Jump to: navigation, search


Dynamic DNS (DDNS) is a DNS caching service (see also wikipedia:Dynamic DNS)

DD-WRT uses inadyn as its embedded dyndns client solution.

Contents

[edit] Dynamic DNS service providers

[edit] Configuration

[edit] Predefined

DD-WRT provides a set of predefined configurations for the most common DDNS services. After choosing from one of the predefined DDNS services, you have to provide the "User Name" and the "Password" for the account of your DDNS service. In the "Host Name" field, you have to enter the fully qualified name of your dynamic domain (e.g. myhostname.example.org).

[edit] Multiple DDNS host names

If you have multiple host names registered at your DDNS service, you can enter them in the "Host Name" field using the "-a" option.

Example: You want to update the IP address for myhostname1.example.org, myhostname2.example.org and myhostname3.example.org; in this case, you have to enter in the "Host Name" field the following string: "myhostname1.example.org -a myhostname2.example.org -a myhostname3.example.org". (Note: no "-a" for the first host name.)

[edit] Custom (URL Updates)

With url updates, the client program usually submits a request using the hypertext transport protocal (HTTP) to a DDNS Server. The request may contain your requested hostname (your dynamic domain name) and/or your IP address. The server then asks for the username and password. The client program returns the information to authorize itself, and the update is completed with the server request response to verify the result.

When your DDNS Service provider uses URL updates, you need to know the url which the client program requests. An example of such a url is:

http://example.com/dyndns/update?hostname=hostname.example.org&ip=1.2.3.4

The URL is divided into parts, the parts should be simple to divide.

Protocol Usually appears first and is followed by "://"
Location Usually after protocol, this can be an IP address or a domain name
Port (optional) Sometimes appears after location, only appears after a colon.
URI The last part of the URL, which can be subdivided. It normally appears after the location and port.

The URI can be subdivided even futher. Most of the URI is optional.

URI Location Everything before the "?" or "#" ("?" first).
URI Parameters Everything after the "?" and before the "#". There can be many parameters. Many times, as in the above example is it specified in the "name=value" form. And commonly when more than one value needs to be specified, it is divided with "&" so "name1=value1&name2=value2&name3=value3" can be used to specify three parameters.
URI Link Everything after the "#", used to specify a specific point in a page.

The example request above is:

Protocol http
Location example.com
Port Not specified
URI /dyndns/update?hostname=hostname.example.org
URI Location /dyndns/update
URI Paramater "hostname" hostname.example.org

To confirm that you have the correct URL and can manually update your IP by using your web browser. When prompted, input your registered username and password. If you aren't registered, register one and setup (add) your dynamic domain name first. Once you have the information, you should be able to set it up using DD-WRT.

  1. Login to the Web GUI, Set DDNS under "Setup" to "custom"
  2. If the URL paramaters have "hostname" use "dyndns@dyndns.org" for DNS System. Otherwise use "custom@http_svr_basic_auth"
  3. Enter "Username" and "Password" with your registered username and password of your DDNS service provider.
  4. Fill in your hostname in "Host Name"
  5. Complete options in "Additional DDNS Options" textarea.
  6. Save Changes and Reboot Router

[edit] Additional DDNS Options

For the custom DDNS to work properly we must specify options so that the program knows what to do.

  • Specify the Server Name option, this is Location and perhaps the port (if specified) of the URL.
  • Specify Server URL Option. If you used the "dyndns@dyndns.org" as "DNS System" you need to specify the Server URL option as just the URI Location; otherwise you need to specify the entire URI.

Using the example above, the Additional DDNS Options should be:

" --dyndns_server_name example.com --dyndns_server_url /dyndns/update"

If this isn't working, try pinging checkip.dyndns.org. You may have to use the "ip_server_name" option if you are unable to recieve a response. The IP address option is used to specify an alternate source to get your IP. Many websites have options to view your IP Address. For the update to work properly, the IP Address check must be be done on the server side (no javascript/vbscript) and your ip address must be the first address on the page. You may need to confirm this by using "View Source" in your browser.

Example:

http://www.dnsstuff.com/tools/my-ip-address.ch

Dividing this URL is similar to dividing the one above:

Protocol http
Location www.dnsstuff.com
Port Not specified
URI /tools/my-ip-address.ch
URI Location /tools/my-ip-address.ch

The "ip_server_name" option uses the Location and the URI. If there is not a URI, use "/"

The "ip_server_name" string using the server above should be:

"--ip_server_name www.dnsstuff.com /tools/my-ip-address.ch"

Note the space beteen the Location and URI.

If you have multiple dyndns domains under the same account and need to update them together, you can add one or more "-a" options to do so. ie, "-a SECOND_HOSTNAME.example.com". This only works if the domains are under the same provider and account.

So, finally, the additional options should be complete and will work in general cases.

[edit] Examples

[edit] dnsExit.com

dnsExit.Com is a domain registrar that provides DDNS and free second level domains with DDNS.

DDNS Service: Custom
DYNDNS Server: update.dnsexit.com
Username: BOGUS
Password: BOGUS
Host Name: 'Your Domain Name'
URL: /RemoteUpdate.sv?login=USERNAME&password=PASSWORD&host=host1.YOUR DOMAIN NAME&myip=
myip=is left blank and automatically detected. host can have multiple hosts(subdomains) updated at the same time by seperating each host by ;. ie. host=host1.mydomain.com;host2.otherdomain.com.

For more details, see Dynamic DNS Clients - Software, Specifications and Guidelines

DD-WRT screen capture
DD-WRT screen capture
Working dnsExit.Com example for Free Second Level Domain

(tested with DD-WRT builds 19342 and 26138)

DDNS Service: Custom
DYNDNS Server: update.dnsexit.com
Username: your_username
Password: your_password
Host Name: your_host.linkpc.net
URL: http://update.dnsexit.com/RemoteUpdate.sv?login=your_username&password=your_password&host=

Replace "your_" entries above with your own information.

[edit] Dynu.com

Dynu Systems provides free dynamic DNS service for third level domain names provided by Dynu as well as your own domain names.

DDNS Service: Custom
DYNDNS Server: api.dynu.com
Username: your Dynu username
Password: your Dynu password or MD5 hash of password
Host Name: your Dynu hostname(e.g. example.dynu.com or example.com)
URL: Leave empty

For a more detailed tutorial, Dynu dynamic DNS setup for dd-wrt is available.

[edit] dnsdynamic.org

Similar to Hurricane Electric's configuration, you can set up your Dynamic DNS setup thusly:

http://[USERNAME]:[PASSWORD]@www.dnsdynamic.org/api/?hostname=[DOMAIN]&myip=[IP]

Substitute your account setting for those in CAPS

DDNS Service Custom
DYNDNS Server www.dnsdynamic.org
User name 'USERNAME'
Password 'PASSWORD'
Hostname 'DOMAIN'
IP Address 'IP'
URL /api/?

Patch should be in code eventually, but for now it can also be found here and in the latest source code:

https://dev.openwrt.org/changeset/29121/

See: http://www.dnsdynamic.org/compatibility.php

[edit] he.net

Similar to dnsdynamic.org's configuration, you can set up your Dynamic DNS setup thusly:

http://[USERNAME]:[PASSWORD]@dyn.dns.he.net/nic/update?hostname=[DOMAIN]&myip=[IP]

Substitute your account setting for those in CAPS

DDNS Service Custom
DYNDNS Server www.dnsdynamic.org
User name 'USERNAME'
Password 'PASSWORD'
Hostname 'DOMAIN'
IP Address 'IP'
URL /nic/update?

[edit] zoneedit.com

At the time of writing this (7-Oct-2010) the inadyn client fails to update host names on zoneedit.com. This is because zoneedit.com no longer has their old update server is offline for some reason. Instead you will now need to make a custom entry ( See http://www.zoneedit.com/doc/dynamic.html#faq11 ). You just need to replace dynamic.zoneedit.com with www.zoneedit.com wherever you see it. This should fix the problem.

[edit] dtdns.com

DTDNS uses a simple URI based updater, none of the form fields matter except the Server but dd-wrt requires them, this configuration works for me.
DDNS Service: Custom
DYNDNS Server: www.dtdns.com
Username: xx
Password: xx
Host Name: {your hostname}
URL:/api/autodns.cfm?id={your hostname}&pw={your hostname's password}&client=dd-wrt

[edit] dnspark.com

The URL listed below did not work for me, followed the developers information at dnspark and the proper URL seems to be:

 /api/dynamic/update.php?mx=ON&mxpri=5&hostname= 

All else below seems correct.

dnspark.com
This configuration has worked for me.
DDNS Service: Custom
DYNDNS Server: www.dnspark.net
Username: your ddns' username
Password: your ddns' password
Host Name: your fqdn ex: www.dd-wrt.com
URL: /visitors/update.html?mx=ON&mxpri=5&hostname=
Additional DDNS Options: --verbose 5

I used the "Additional Option" to verify that it is working, It gives a result of "OK" if it works. Warning the log will be quite lengthly if you use --verbose 5, it is not recommended after it is functional.

Example/Edited log below for a successful update.

Tue Sep 16 00:00:00 2008: INADYN: Started 'INADYN Advanced version 1.96-ADV' - dynamic DNS updater. Tue Sep 16 00:00:00 2008: The request for IP server: GET http://checkip.dyndns.org/ HTTP/1.0


Tue Sep 16 00:00:00 2008: DYNDNS: IP server response: HTTP/1.1 200 OK Content-Type: text/html Server: DynDNS-CheckIP/1.0 Connection: close Cache-Control: no-cache Pragma: no-cache Content-Length: 106

Current IP Address: 192.168.1.1

Tue Sep 16 00:00:00 2008: W: DYNDNS: My IP address: 192.168.1.1 Tue Sep 16 00:00:00 2008: I:INADYN: IP address for alias 'www.dd-wrt.com' needs update to '192.168.1.1' Tue Sep 16 00:00:00 2008: DYNDNS my Request: GET /visitors/update.html?mx=ON&mxpri=5&hostname=www.dd-wrt.com HTTP/1.0 Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxx Host: www.dnspark.com User-Agent: inadyn advanced/1.96-ADV software@stevehorbachuk.com


Tue Sep 16 00:00:00 2008: I:INADYN: Alias 'www.dd-wrt.com' to IP '192.168.1.1' updated successfully. Tue Sep 16 00:00:00 2008: W:INADYN: DYNDNS Server response: HTTP/1.0 200 OK Connection: close Expires: Wed, 17 Sep 2008 00:00:00 GMT Expires: Thu, 19 Nov 1981 00:00:00 GMT Cache-Control: max-age=86400 Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 X-Powered-By: PHP/5.2.6 Set-Cookie: DNSPARKSESSID=xxxxxxxxxxxxxxxxxxxxxxxx; path=/; secure Pragma: no-cache Content-type: text/html Date: Tue, 16 Sep 2008 00:00:00 GMT Server: lighttpd/1.4.18

ok

[edit] 3222.org

Example option for 3322.org (a chinese dyndns provider)

Username: USERNAME Password: PASSWORD Registered Dynamic Domain Name: SAMPLEHOSTNAME.3322.org

Typical url: http://www.3322.org/dyndns/update?system=dyndns&hostname=SAMPLEHOSTNAME.3322.org

[1]

option string, using a chinese ip_server

using dyndns@dyndns.org " --dyndns_server_name www.3322.org --dyndns_server_url /dyndns/update? --ip_server_name www.bliao.com:2000 /ip.phtml "

using custom@http_svr_basic_auth: " --dyndns_server_name www.3322.org --dyndns_server_url /dyndns/update?hostname= --ip_server_name www.bliao.com:2000 /ip.phtml "


[edit] freedns.afraid.org

Go to http://freedns.afraid.org/dynamic/ and login with your normal username and password for the freedns service. Click Direct URL on the domain you would like to be set to your WAN IP address. Copy everything from the right of the ? in the address bar.

Router Settings:

DDNS Service: freedns.afraid.org

User Name: USERNAME

Password: PASSWORD

Host Name: yourdomain.com,What_You_Copied_Before

Force Update Interval 10


(Note: Since afraid.org doesn't require a username and password when doing a "wget-style" update, you can also just do the following to keep from exposing your username and password:

User Name: guest

Password: guest

[edit] DNS-O-Matic

DNS-O-Matic provides you a free and easy way to announce your dynamic IP changes to multiple services with a single update. Using DNS-O-Matic allows you to pick and choose what Dynamic DNS services you want to notify, all from one easy to use interface.
DNS-O-Matic with dd-wrt
DNS-O-Matic with dd-wrt

More info can be found in the forums. Using DNS-O-Matic is an easy way to update your favorite dynamic dns service and OpenDNS (which currently does not work with dd-wrt's built in inadyn).


DDNS Service: Custom
DYNDNS Server: updates.dnsomatic.com
User Name: your dns-o-matic username
Password: your dns-o-matic password
Host Name: all.dnsomatic.com
URL: /nic/update?

Additional info can be found in the OpenDNS article.

[edit] DynDNS

Info: in v24SP2 it works with the preset, again!

The below is my setting for dynamic DDNS using dyndns.org

  • substitute your account setting for those in quotes
DDNS Service Custom
DYNDNS Server members.dyndns.org
User name 'Your DynDNS username'
Password NOT YOUR ACCOUNT PASSWORD - Use your 'Updater Client Key' available under Account Settings on accountdyn.com
Hostname 'Your DynDNS hostname'
URL /nic/update?
Additional DDNS Options --dyndns_system dyndns@dyndns.org --ip_server_name checkip.dyndns.org:8245 /
Use external ip check no

If static DNS is used, use statdns@dyndns.org instead of dyndns@dyndns.org.

Your ddns password should contain no spaces at the beginning or end of it.

As of 2013 DnyDNS changed this licence term for free accounts. You will have to login every 30 days to keep your account alive. Some guys in the DynDNS forum created some scripts to manage the login automaticly. Use this scripts (wget version) as custom script with cron.

[edit] NameCheap

NameCheap is a domain registrar that includes free dynamic dns with the host registration. Under $10/year. NameCheap doesn't use normal http auth for updating, so you have to include your domain and password in the URL. Anything between brackets should be changed to your appropriate information. Do not put anything after the &host= in the URL option!

DDNS Service: Custom
DYNDNS Server: dynamicdns.park-your-domain.com
Username: (Any jibberish can go here.)
Password: [Your NameCheap-defined Dynamic DNS password]
Host Name: [Your subdomain ('www' for the standard, or '@' for no subdomain)]
URL: /update?domain=[your domain]&password=[your password]&host=


Note: If you would like to update the IP address for more than one subdomain, separate each subdomain in the Host Name box with an '-a' argument. For instance:

Host Name: www -a webmail -a waycoolstuff

would cause www.[your domain], webmail.[your domain], and waycoolstuff.[your domain] to be updated to the same IP address.

Updated Dec 1, 2009, after the instructions provided at electronox.net (see link below) worked. Dmcg 22:30, 1 December 2009 (CET)

(Note: I think these instructions may be old. It doesn't cost anything now. I registered my domain at godaddy and was able to change the nameservers to those from namecheap. Also, for ddns, try using your domain name in the username field and the password generated by namecheap (specifically for ddns -- *not* your login password!) in the password field. And it doesn't seem to need the password in the url as part of the get request (which is kind of stupid, sending it in the clear...). This worked for me. see http://www.electronox.net/blog/how-to/namecheap-ddns-and-ddwrt --wikiterra Aug 8, 2009)

(Follow up: Leaving the password out of url does not seem to work as that site suggests, otherwise it works correctly. On another note, does anyone know how to force ssl? Namecheap's dyndns server works with https, but the interface in dd-wrt doesn't seem to have that option, at least not in an obvious way. --wikiterra March 30, 2010)

[edit] CHANGEIP.COM

The information below is how to configure your router to update www.ChangeIP.com dynamic dns hostnames:

  • substitute your account setting for those in quotes
DDNS Service Custom
DYNDNS Server nic.changeip.com
User name 'Your ChangeIP.com username'
Password 'Your ChangeIP.com password'
Hostname 'Your DynDNS hostname' or '*1' for Group #1
URL /nic/update?system=dyndns&hostname=
Additional DDNS Options --ip_server_name ip.changeip.com /

[edit] Regfish

Regfish is a domain registrar that provides dyndns updates.

DDNS Service: Custom
DYNDNS Server: dyndns.regfish.de
Username: something
Password: something
Host Name: mydomain.de
URL: ?token=DynDNS_Kennwort&fqdn=mydomain.de.&thisipv4=1&

Note: The domain name in 'fqdn=' must end with a period, and the whole URL string must end with an ampersand.

[edit] Zerigo.com

The information below is how to configure your router to update www.Zerigo.com dynamic dns hostnames:

  • substitute your account setting for those in quotes
DDNS Service Custom
DYNDNS Server update.zerigo.com
User name 'Your Zerigo.com username/email address'
Password 'Your Zerigo.com API Key (NOT your password)'
Hostname 'Your DynDNS hostname'
URL /dynamic?host=

[edit] Nettica

nettica Nettica is a global provider of DNS services, domain registration, and email services for customers hosting their own sites. Our diverse network and 100% uptime guarantee keeps your business running.

DDNS Service Custom
DYNDNS Server update.nettica.com
User name 'Your nettica username'
Password 'Your nettica password'
Hostname 'Your nettica hostname (comma separated for multiple hosts)'
URL /nic/update?hostname=
Additional DDNS Options

[edit] OVH

[2] is a domain registrar that provides dyndns updates.

DDNS Service: Custom
DYNDNS Server: www.ovh.com
Username: yourdomain.com-host
Password: yourpassword
Host Name: yourdynhost.yourdomain.com
URL: http://www.ovh.com/nic/update?system=dyndns&hostname=
Additional DDNS Options --verbose 5

[edit] Joker.com

Joker is a DNS registrar and also offers a dynamic dns update service for domains registered. Just add a Dynamic DNS record (DYNA record) for your domain in the joker.com service zone. Use the username and password generated for that record to configure your DDWRT DDNS service as follows:

DDNS Service Custom
DYNDNS Server svc.joker.com
User name 'DYNA record username'
Password 'DYNA record password'
Hostname 'DYNA record hostname'
URL /nic/update?hostname=


[edit] Strato.com

Strato is a Webservice Provider.

DDNS Service Custom
DYNDNS Server dyndns.strato.com
User name 'your domain' (one of your domains)
Password 'strato master password'
Hostname 'your domain'
URL http://dyndns.strato.com/nic/update/?hostname=


[edit] Nubem.com

Nubem offers Free Dynamic DNS Service for third level domains of mynubem.com. Additionally dynamic DNS works on all your own domain names registered on Nubem.

Please note that in this sample configuration we suppose that you Nubem username is peterg and that your pasword is letmein. The associated free ddns hostname is peterg.mynubem.com. Remember to replace the example values with your own ones. We are using the private ip 10.20.30.40 for the updates: Nubem will automatically determine your public ip.

DDNS Service: Custom
DYNDNS Server: nubem.com
Username: your Nubem username (peterg)
Password: your Nubem password (letmein)
Host Name: your Nubem hostname(peterg.mynubem.com)
URL: /nic/update?username=peterg&password=letmein&hostname=peterg.mynubem.com&myip=10.20.30.40

Remember to replace the provided sample values with your own ones.

A more detailed configuration with graphical screen shoots is available at KB1438101240. Dynamic DNS Service API documentation is provided as well.

[edit] Give UP?

I gave up on trying to setup my freedns.afraid.org setup and just set a cron script at startup to use freedns' wget method of updating my dns every 5 minutes on the router. If this does not work for you, some variation on this theme might:

echo '*/5 * * * * root /usr/bin/wget http://freedns.afraid.org/dynamic/index.php?action=script&data_id=XXXXXX -O - >/dev/null 2>&1' >> /tmp/crontab

NOTE: In the above, the XXXXXX is an id number provided by freedns.afraid.org

Note2: This shouldn't be necessary and causes more traffic than is needed. Please read my entry in the afraid.org section above. It does work.

Note3: FYI the busybox wget command on your version of dd-wrt may not work with https, so you may have to use the unsecure http protocol to update DNS via URL.

[edit] Secure DDNS Updates Over HTTPS/SSL

As of DD-WRT v24, the inadyn client embedded in most DD-WRT releases does not support HTTPS/SSL updates. This means your username and password are sent in clear text over the Internet. Advanced users can use a simple script which utilizes curl to make these updates in a more secure manner until a newer version of inadyn which supports HTTPS can be included.

  1. First, enable JFFS under Administration>Management, or using the instructions available here
  2. Run "mkdir /jffs/opt" from your router's command line
  3. Run "mount -o bind /jffs/opt /opt"
  4. Run "opkg update" and then "opkg install curl", verify that curl is installed in /opt/usr/bin.
  5. Download the CA bundle for curl - "cd /opt/usr/bin" then "wget https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt"
  6. Get the example script from the DD-WRT Scripting Wiki Page
  7. Copy the script into /opt/usr/bin/dyndns.sh
  8. Edit the settings section of dyndns.sh to match your DynDNS provider and save
  9. Run "chmod 755 /opt/usr/bin/dyndns.sh" to make the script executable
  10. Now just add the following commands to your startup commands in Administration>Commands
    • mount -o bind /jffs/opt /opt
    • sleep 5
    • /opt/usr/bin/dyndns.sh

This script will enter an endless loop and check/update your IP in the interval you specify in the settings section. Curl is able to make these updates securely using HTTPS.

[edit] Debugging your configuration

[edit] Logging Options

For inadyn/DDNS you can set log options from command line (SSH/Putty) this will get you more verbose log options, default is notice:

nvram set ddns_loglevel=[debug|info|notice|warning]

So if you want to see everything do:

nvram set ddns_loglevel=debug

After that restart DDNS:

service ddns restart

It will output a lot of information to syslog view with:

grep -i -E 'ddns|inadyn' /var/log/messages

When you are done reset to default value (which is notice)

nvram unset ddns_loglevel && service ddns restart

[edit] Configuration File Checking

Internally, DD-WRT uses inadyn and creates in the directory /tmp/ddns a configuration file from your settings in the web form.
To check whether the expected configuration file is created from your settings in the web form, you can inspect this file as follows:

  • ssh or telnet to the router
  • navigate to /tmp/ddns: cd /tmp/ddns
  • inspect file inadyn.conf: cat /tmp/ddns/inadyn.conf
  • the inadyn cache file in DD-WRT is located /tmp/ddns/[ipv4|ipv6]@[provider]-[yourhostname].cache

If you are not familiar with the format of the inadyn.conf file, you can just call /usr/sbin/inadyn --help from the command line and the allowed parameters are shown.

[edit] Custom Configuration

You can start inadyn with your own configuration file:

First stop inadyn:

killall inadyn

Restart but after -f specify your own config file e.g. /jffs/inadyn.conf , after -l you set loglevel, see above:

inadyn --cache-dir=/tmp/ddns -e ddns_success --exec-mode=compat -f /jffs/inadyn.conf -P /var/run/inadyn.pid -l info -t 30 -C

The default startup of inadyn can be viewed after stopping and restarting with ( SSH/telnet): ps , this will show e.g.:

inadyn --cache-dir=/tmp/ddns -e ddns_success --exec-mode=compat -f /tmp/ddns/inadyn.conf -P /var/run/inadyn.pid -l notice -t 30 -C

[edit] Password conventions

Have a look at the characters you use in your password. If there is a "#" in it, it won´t work because linux parses everything in the config file, that´s behind a "#" as a comment!

[edit] See also

[edit] External Links