Dynamic DNS Setup

Dynamic DNS Tutorial

1.Getting your external IP

Login your VNC Console.

Run “curl ifconfig.co”, you may need to install curl first.

Then you can connect to your VPS via SSH, using your external IP.

2.Using crontab and CloudFlare API for DDNS update.

Script:

https://gist.github.com/larrybolt/6295160/raw/c634c48c001a411240fc78147949a6a32e1de370/cf-ddns.sh

Edit the sections to the screenshot below: (https://i.imgur.com/rfJWuqZ.png)
DDNS Setup


Leave CFID empty at this time.

For example, Your domain is example.com, and your preferred DDNS domain is ddns.example.com.

You should fill the blanks as the screenshot below: (https://i.imgur.com/BXNTpxT.png)

DDNS Setup

Just execute this script and it will fetch all your subdomains’ CFID. Pick your preferred DDNS’ CFID and fill it to the script. (https://i.imgur.com/hl4zBw6.png)


DDNS Setup

At last, add this script to crontab, you can automatically update your DDNS.

For crontab tutorial, see https://www.tutorialspoint.com/unix_commands/crontab.htm

Troubleshooting
Failed to curl?
ping 8.8.8.8, if reachable:
echo "nameserver 8.8.8.8">/etc/resolv.conf 
and try curl ifconfig.co again.