Skip to content

Ubiquiti EdgeRouter Dynamic DNS Script

The following is an example of a Dynamic DNS (DDNS) update script for Ubiquiti Networks EdgeRouter using GoDaddy as an example.

vi /etc/dhcp/dhclient-exit-hooks.d/GoDaddy

# Save as /etc/dhcp/dhclient-exit-hooks.d/GoDaddy

# I want to update multiple A records
names=( host1 host2 host3 )

# The domain I own and my GoDaddy API Key/Secret
headers="Authorization: sso-key $key:$secret"

currentIp=$(curl -s GET "")

for name in "${names[@]}"
    result=$(curl -s -X GET -H "$headers" "$domain/records/A/$name")
    dnsIp=$(echo $result | grep -oE "b([0-9]{1,3}.){3}[0-9]{1,3}b")
    if [ $dnsIp != $currentIp ];
        curl -i -s -X PUT -H "$headers" -H "Content-Type: application/json" -d $request 

Now all you have to do is make it executable using chmod:
chmod +x /etc/dhcp/dhclient-exit-hooks.d/GoDaddy

WARNING: Scripts do not persist after an upgrade. You have to re-install them.

Published inTech

One Comment

  1. I do something very similar. You can have the scripts survive upgrades by putting them under the /config directory. I created te following…


    and then put the scripts in there. in your instance


    Then I have it run via the task scheduler every 5 minutes or so… I’t only reaches out to GoDaddy if the IP has actually changed. If not, it just exits.

Leave a Reply

Your email address will not be published. Required fields are marked *