Dynamic DNS with ZoneEdit and Firewalla Gold+
Currently the Firewalla Gold+ doesn't support third party Dynamic DNS providers natively. One way you can add in support for third party solutions is by using the scripting capabilities of the Firewalla and ddclient.
Prerequisites
- Firewalla capable of scripting support (Purple, Gold, Gold+, etc)
- SSH access to the Firewalla
- Dynamic DNS provider
Instructions
Start by logging into the Firewalla via SSH.
Navigate to the /home/pi/.firewalla/config/post_main.d directory. If this directory doesn't exist create it.
cd /home/pi/.firewalla/config/post_main.d
Create a new file using VI or Nano or your favorite editor. Only VI is installed by default, you can install others by using APT if you choose to. I called the file ddns.sh but you can name it whatever you can.
vi ddns.sh
Copy the following script into the new file and modify the values at the top to fit your configuration. I currently have it configured to user ZoneEdit, and you should only need to modify DD_LOGIN, DD_PASSWORD, and DD_HOST to work for ZoneEdit.
#!/bin/bash
# Modify these attributes to fit your configuration
DD_USE='if, if=eth0' # see ddclient docs for more
DD_PROTOCOL='zoneedit1' # e.g. googledomains, dyndns2
DD_SERVER='dynamic.zoneedit.com'
DD_LOGIN='username'
DD_PASSWORD='token_from_zoneedit'
DD_HOST='domain'
DD_INTERVAL='600' # seconds
INSTALL_IT=0
RUN_IT=0
# Look for the client sleeping shortened message
RUNNING=$(pgrep 'ddclient - sle')
INSTALLED=$(command -v ddclient)
if [ -z "${RUNNING}" ] ; then
if [ -z "${INSTALLED}" ] ; then
INSTALL_IT=1
RUN_IT=1
else
echo "----- ddclient is already installed -----"
RUN_IT=1
fi
else
echo "----- ddclient is already installed and running -----"
fi
if [[ ${INSTALL_IT} = 1 ]] ; then
echo "----- installing ddclient -----"
#unalias apt-get
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install ddclient
fi
if [[ ${RUN_IT} = 1 ]] ; then
echo "----- configuring /etc/ddclient.conf -----"
sudo bash -c "cat << EOF > /etc/ddclient.conf
ssl=yes
syslog=yes
#debug=yes
verbose=yes
quiet=no
use=${DD_USE}
protocol=${DD_PROTOCOL}
server=${DD_SERVER}
login=${DD_LOGIN}
password='${DD_PASSWORD}'
${DD_HOST}
EOF"
echo "----- configuring /etc/default/ddclient -----"
sudo sed -i -e "s/run_dhclient=\"true\"/run_dhclient=\"false\"/g" -e "s/run_ipup=\"true\"/run_ipup=\"false\"/g" -e "s/run_daemon=\"false\"/run_daemon=\"true\"/g" -e "s/daemon_interval=\"[0-9]\+\"/daemon_interval=\"${DD_INTERVAL}\"/g" /etc/default/ddclient
echo "----- enabling and starting ddclient service -----"
sudo systemctl enable ddclient
# Do 'restart' instead of 'start' because the latter doesn't pick up the new interval from /etc/default/ddclient
sudo systemctl restart ddclient
fi
After saving this new file, modify the permissions so that it can run.
chmod 555 ddns.sh
Now you should be able to run the script, it will setup ddclient for you, and then create a configuration file for you.
./ddns.sh
You can verify everything is working correctly by looking at /var/log/syslog.
References
The original script was developed by David Koppenhofer from this link. https://help.firewalla.com/hc/en-us/community/posts/11393144303123-ddclient-dynamic-DNS-install-run-script-for-Firewalla-Purple. I modified slightly to support ZoneEdit, specifically adding in the server variable needed to specify the correct server.
https://support.zoneedit.com/en/knowledgebase/article/dynamic-dns