Tuesday, May 31, 2016

Dynamic DNS and OpenDNS on the vyatta box

Vyatta has problems with sending the ddclient traffic to OpenDNS on the same interface that it is updated. This means that the network identity in the OpenDNS dashboard is unreliable, and we get a lot of errors in the Vyatta logs.

The workaround is to disable dynamic DNS configuration in Vyatta, and use a script based on cUrl.
cUrl is like Wget, for downloading URLs, and it can be forced to use a specific interface.

Steps to install:

1. Download the opendns_updater.sh script, and put it in /usr/local/bin/ on Vyatta.

Make sure you update the username and password!
Make it executable with

chmod +x /usr/local/bin/opendns_updater.sh

For convenience, I created one more script, opendns_update_all.sh, with this content, for example you have 5 Internet lines:

/usr/local/bin/opendns_updater.sh <interface1> <Network Identity 1>
/usr/local/bin/opendns_updater.sh <interface2> <Network Identity 2>
/usr/local/bin/opendns_updater.sh <interface3> <Network Identity 3>
/usr/local/bin/opendns_updater.sh <interface4> <Network Identity 4>
/usr/local/bin/opendns_updater.sh <interface5> <Network Identity 5>

2. Schedule it to run using crontab as root.
Every 5 minutes do the update, and every 2 hours get rid of the IP address cache to force a new update.

*/5 * * * * /usr/local/bin/opendns_update_all.sh
58 */2 * * * rm -f /tmp/opendns-*.txt

That's it. This should ensure that our dynamic IP addresses make it to OpenDNS frequently enough!

Credit: Urko Masse