Why set up DDNS?
If your server can freely change its IP and the system can be backed up, then whenever it gets blocked, you can reinstall using this system backup, and your proxy will automatically resolve to the new IP
without needing to reconfigure the machine
Requirements:
1. A domain name
2. A VPS with a dynamic IP, or one whose IP can be changed,
and a server that supports image snapshots after being blocked (recommended here: Google Cloud, Microsoft Azure, and
digitalocean — deleting the machine will get you a new IP)
3. A cloudfare account (you can register one yourself here, and it does not cost anything)
Now let’s begin the installation
Step 1: Change your domain’s DNS servers to cloudfare’s DNS

Step 2: Go to DDNS and get the global API
Website: https://www.cloudflare.com/a/profile

Step 3: Download and configure the script
curl https://gist.githubusercontent.com/benkulbertis/fff10759c2391b6618dd/raw > /usr/local/bin/cf-ddns.sh && chmod +x /usr/local/bin/cf-ddns.sh
Configure the script
vi /usr/local/bin/cf-ddns.sh
Find the following content and modify it
auth_email="your cloud [email protected]"
auth_key="global API key" # found in cloudflare account settings
zone_name="exampl.com domain name, without WWW"
record_name="set a random subdomain yourself, remember to add it in cloudfare"
Then exit and save by entering :wq
Configure this script to run automatically
crontab -e
Then enter vi editing mode and add this line, which means it will run automatically every 10 minutes
*/10 * * * * /usr/local/bin/cf-ddns.sh >/dev/null 2>&1
Enter service crond retart to restart the crontab service
There is also a PYTHON version of the DDNS script here
curl https://raw.githubusercontent.com/AmirAzodi/cloudflare_ddns/master/cf-ddns.py > /usr/local/bin/cf-ddns.py && curl https://raw.githubusercontent.com/AmirAzodi/cloudflare_ddns/master/cf-ddns.conf > /usr/local/bin/cf-ddns.conf && chmod +x /usr/local/bin/cf-ddns.py
Open the configuration file
vi /usr/local/bin/cf-ddns.conf
{
"domains": [
{
"hosts": [
{
"id": "",
"ipv4": "",
"ipv6": "",
"name": "ddns", #Here, DDNS means the prefix of the subdomain
"types": ["A"]
}
],
"id": "",
"name": "wuwweb.com" #Using ddns.wuwweb.com as an example, enter wuwweb.com here
}
],
"user": {
"api_key": "CLOUDFLARE_API_KEY_HERE", #Enter the API
"email": "CLOUDFLARE_EMAIL_HERE" #Enter the CloudFlare email
}
}
Likewise, you also need to add a crontab scheduled task.
Enter crontab -e, then enter vi and add the following line, then enter :wq to save.
*/10 * * * * /usr/local/bin/cf-ddns.py >/dev/null 2>&1