Google’s permanent free hosting (Always Free) will automatically get a free public ipv4 address every time you start, but every time you reboot it will be updated (you can change the temporary ip to a static ip that will not change every time you reboot, this article does not discuss this solution)
Use the ddclient service to automatically update the A-record of a domain name in Cloudflare, and then configure the domain name resolution of the desired website to point to this A-record, so that you can use the service without using a static fixed IP.
1. Create CloudFlare API Token For Domain
Open https://dash.cloudflare.com/profile/api-tokens ,
Click the button : Create Token ⬇️
Use “Edit zone DNS” template ⬇️
Select the domain name you need to use ⬇️
Copy token
2. Install ddclient
sudo apt install ddclient
3. Configuring the ddclientClick to apply
sudo vi /etc/ddclient.conf
# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf
syslog=yes
daemon=600
# get real public IP
use=cmd
cmd='curl http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip -H "Metadata-Flavor: Google"'
# Cloudflare api
protocol=cloudflare
ssl=yes
zone=your domain.com
#ttl=1
#login=
password='your token'
# renew your dommain's A record
sub.your domain.com
Note: Because cloudflare updated the new api interface, only the token is needed, not the username, if you do not comment out the error will explode:Response Data: {“success”:false, “errors”:[{“code”:6003, “message”: “Invalid request headers“, ‘error_chain’:[{”code”:6103, ‘message’: ‘Invalid format for X-Auth-Key header’}]}]], ‘messages’:[], ‘result’:null} , this error was found only when the When you find this error, you just need to comment out the username.
Check Status
sudo tail -F /var/log/syslog
2025-01-01T11:10:14.699905+08:00 instance-1 ddclient[691]: SUCCESS: updating aaa.worldnethost.com: IPv4 address set to ***.198.11.***
Setting up cname records for domain name
Over .