Setup a freeDNS account
mouse 3366 · person cloud · link
Last update
2017-11-09
2017
11-09
« — »

Register for a freeDNS account, create a new subdomain then visit Dynamic DNS section and insert your Direct URL and subdomain in this updater script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

# /opt/bin/freesnd.afraid.org.sh
# FreeDNS updater script => https://freedns.afraid.org/api/

UPDATEURL="http://freedns.afraid.org/dynamic/update.php?YOUR_KEY"
DOMAIN="YOUR_SUBDOMAIN"
BINDADDR="192.168.1.110"

registered=$(dig @208.67.222.222 +short $DOMAIN)
current=$(dig -b $BINDADDR @208.67.222.222 +short myip.opendns.com)

if [ "$current" != "$registered" ]; then
  wget -q -O /dev/null --bind-address=$BINDADDR $UPDATEURL 
  echo -n "DNS updated on: "; date
fi

then put it in root crontab:

1
2
#  m   h   dom   mon   dow   command
 */6   *     *     *     *   /opt/bin/freesnd.afraid.org.sh > /dev/null