OpenWrt dyndns with ez-update

Tutorial Icon: 
This is a quick tutorial on how to get OpenWrt to update with dyndns.org. If you are unfamiliar with dyndns.org it is basically a service that allows your residential IP address to be mapped to a friendly URL similar to DNS. The benefit to dyndns is that you don't need to run your own name servers and when your dynamic IP address at home changes you can still reach your server via the dyndns address.

The purpose of ez-update is to update your current IP address on your router with the dyndns servers. This allows them to keep track of your IP address if it changes.

First get the package installed

ipkg install ez-ipupdate

Once ez-update has installed sucessfully you will need to use vi or your favorite editor to modify the configuration file in /etc/ez-ipupdate.conf.

Here is an example of my configuration:

service-type=dyndns
user=johndoe:mypass
host=tuxtutorials.dyndns.org
quiet

# Do not change the lines below
cache-file=/tmp/ez-ipupdate.cache
pid-file=/var/run/ez-ipupdate.pid

Once you have this info filled out we need to create the start and stop script in the /etc/init.d directory. So we need to issue:

vi /etc/init.d/S96dyndns

and paste the following script into the file.

#!/bin/sh
case "$1" in
        start)
                ez-ipupdate -c /etc/ez-ipupdate.conf -i ppp0
        ;;
        restart)
                ez-ipupdate -c /etc/ez-ipupdate.conf -i ppp0
        ;;
esac

After you have entered the contents above into the script we need to make the script executable. Execute the following command:

chmod +x /etc/init.d/S96dyndns

This will make it executable by the owner of the file.

Last we need to add this to cron to update every 30 minutes or so. You can change this to how often you would like by I think 30 minutes is plenty. To do this edit the /etc/crontabs/root file. This is roots cron job. Put the following into the file once you have it open with your editor.

* 30 * * * /etc/init.d/S96dyndns start

This basically says to update with the dyndns server your IP address every 30 minutes. Run the script or wait til the cronjob runs and make sure to verify that the dyndyns servers received an update by logging into your account.