Avatar of Andrea Pavone
Andrea Pavone

Cloudflare as a Dynamic DNS

If you need to have a DNS record that point to a Dynamic IP (DDNS), for example, your home IP address, this tool allow you to accomplish this job!

For do this this we need cloudflare-dynamic-ip tool allow you to simply have a specific DNS record such as home.example.com that point to your dynamic IP.



Clone the Github repo, install dependencies, set API Token and set a cron job every 15min that run this script and you're done! 

git clone https://github.com/andp97/cloudflare-dynamic-ip.git
cd cloudflare-dynamic-ip
composer install --no-dev
nano .env
echo -e "*/15 * * * * $INSTALL_PATH/cf-ip 2>&1 > /dev/null\n"
crontab -e

You can also execute this script via bash

#Get dns record name from env and target ip from remote host (https://ip.andreapavone.com) 
#Passing parameters to the script
./cf-ip <dns_record_name> <target_ip>

On .env file you can set:


git pull
composer update