Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
USG ddclient Upgrade Script

How to use this script?

Why, that's simple! Copy this script to your USG, run chmod +x on it and then, as a user with sudo permission, execute it.

Shamelessly borrowed from Brittanic on the Ubiquiti Unifi forums

How to use it?

Simply run the following command (note, if you are at all security concious-don't run it and instead review the script, then copy it to your USG to execute).

curl https://gist.githubusercontent.com/troyfontaine/7e6f93e32621177fc9a94e823adc52b5/raw/fix_ddns.sh | sudo bash

But I don't see Cloudflare in the Unifi Controller!

Well you won't? This updates the client-so you still need to use the config file method of telling the USG to use ddclient to talk to Cloudflare.

Why do I need it smart guy?

If you haven't heard, Cloudflare deprecated their older API in favor of their newer-so the old ddclient still included in the Unifi line of routers can't talk to it anymore.

For those of us who use Cloudflare for DDNS-it kinda sucked. This helped.

#!/bin/bash
# Run this script as sudo
# Specify the repo and the location of the apt sources list
DEB_REPO="deb http://archive.debian.org/debian/ wheezy main # wheezy #"
APT_SRC="/etc/apt/sources.list"
# Add deb repo to sources list if it isn't there
grep -q -F "$DEB_REPO" "$APT_SRC" || echo "$DEB_REPO" >> "$APT_SRC"
# Run Apt update
apt-get update; apt-get -y install libdata-validate-ip-perl
# Download new ddclient and replace the existing version
cd /tmp
curl -L -O https://raw.githubusercontent.com/ddclient/ddclient/master/ddclient
cp /usr/sbin/ddclient /usr/sbin/ddclient.bkp
cp ddclient /usr/sbin/ddclient
chmod +x /usr/sbin/ddclient
# Tell the USG to update configuration and then display the status
# Run the following manually to update your DDNS record:
# update dns dynamic interface eth0 && sleep 20 && show dns dynamic status
@mihalski

This comment has been minimized.

Copy link

mihalski commented Jun 16, 2019

Will this work on a current stretch based (rather than the old wheezy based) USG?
I ask because I've just recovered from bricking my system after following instructions at https://help.ubnt.com/hc/en-us/articles/205202560-EdgeRouter-Add-Debian-Packages-to-EdgeOS so that I could install if top which overwrote libc and destroyed the USG.

@troyfontaine

This comment has been minimized.

Copy link
Owner Author

troyfontaine commented Jun 16, 2019

Will this work on a current stretch based (rather than the old wheezy based) USG?
I ask because I've just recovered from bricking my system after following instructions at https://help.ubnt.com/hc/en-us/articles/205202560-EdgeRouter-Add-Debian-Packages-to-EdgeOS so that I could install if top which overwrote libc and destroyed the USG.

Yep, I've been using it after every update and have been having no issue (aside from having to run line 23 manually).

@mihalski

This comment has been minimized.

Copy link

mihalski commented Jun 16, 2019

I've manually downloaded and installed the current releases from the stretch repository just in case using the following commands:

curl http://ftp.debian.org/debian/pool/main/libd/libdata-validate-ip-perl/libdata-validate-ip-perl_0.27-1_all.deb -O
curl http://ftp.debian.org/debian/pool/main/libn/libnet-netmask-perl/libnet-netmask-perl_1.9022-1_all.deb -O
curl http://ftp.debian.org/debian/pool/main/libn/libnet-ipv6addr-perl/libnet-ipv6addr-perl_0.2.dfsg.1-3_all.deb -O
curl http://ftp.debian.org/debian/pool/main/libn/libnetwork-ipv4addr-perl/libnetwork-ipv4addr-perl_0.10.ds-2_all.deb -O

dpkg -i libdata-validate-ip-perl_0.27-1_all.deb libnet-netmask-perl_1.9022-1_all.deb libnet-ipv6addr-perl_0.2.dfsg.1-3_all.deb libnetwork-ipv4addr-perl_0.10.ds-2_all.deb

EDIT: Although I suspect since they're fully text based they're shared across the different Debian releases. My concern is if I try to install something else via apt-get and it borks the system (as it just did when trying to get iftop installed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.