Deploy a fixed domain name for a dynamic IP VPS/NAT VPS using CloudFlare API

Deploy a fixed domain name for a dynamic IP VPS/NAT VPS using CloudFlare API

Previously introduced: using AliDDNS to deploy fixed domain names for dynamic IP VPS/NAT VPS, this time we will use CloudFlare API to deploy fixed domain names for dynamic IP VPS/NAT VPS. Of course, it is still a reprint. Welcome to the TeleGram group discussion: https://t.me/zhujiwiki

1. Method 1 is provided by TG group members. It is the most convenient and recommended.
1. Go to https://dash.cloudflare.com/profile, check your mailbox, and get the API
This is the mailbox

Scroll to the bottom and get the API

2. Configure the file and run it

 wget --no-check-certificate https://zhujiwiki.com/wp-content/uploads/2018/07/CloudFlareDDNS/cloudflare-update-record.sh > /root/ddns.sh && chmod +x /root/ddns.sh

Edit ddns.sh, mainly modify auth_email to your CF email address, auth_key to API KEY, zone_name to your primary domain name, record_name to the secondary domain name you want to use as DDNS (do the resolution before, fill in 127.0.0.1 for the resolution record)

Run the file and check the CF parsing to see if the IP has changed.

 bash ddns.sh

3. Configure Crontab tasks

 crontab -e

Add the following code

 */5 * * * * bash /root/ddns.sh

Check every 5 minutes to see if the IP has changed.

5. Detect IP address
whatismyip.akamai.com, good

Method 2
1. Log in to CloudFlare and get API information

a. Get API KAY

b. Get zone_id

c. Set the domain name resolution to use DDNS

2. Configure DDNS related

a. Download the file to the server where you want to deploy DDNS

 wget --no-check-certificate https://zhujiwiki.com/wp-content/uploads/2018/07/CloudFlareDDNS/CloudFlare_DDNS_Setter.sh wget --no-check-certificate https://zhujiwiki.com/wp-content/uploads/2018/07/CloudFlareDDNS/config.conf

b. Edit config.conf

 vi config.conf

Fill in the CloudFlare account email, API KAY, zone_id

c. Get record_id

 bash CloudFlare_DDNS_Setter.sh

Input 1

You will get a piece of code, which contains the id we need, which is the record_id

d. Continue editing config.conf

 vi config.conf

Fill in the following three items. The record_id is the one you just obtained, the domain name is the domain name you just resolved, and ttl is 120.

e. Analyze dynamic VPS IP

 bash ddns.sh --ddns

Log in to CloudFlare to check whether the IP is automatically changed to the server's IP
If the synchronization fails, please check whether the API_KEY and other information are correct.

f. Configure Crontab tasks

 crontab -e

Add the following code

 */5 * * * * bash /root/ddns.sh --ddns

The original source is https://sometimesnaive.org/article/5, the project address is https://github.com/nanqinlang-script/CloudFlare_DNS_Record, and the pictures and text are https://www.neworld.studio/index.php/archives/93/

<<:  CloudIPLC: 24 yuan/month/384MB memory/4GB SSD space/600GB traffic/NAT/KVM/Jiangsu Mobile

>>:  Magic Cube Cloud: 225 yuan/month/4GB memory/60GB SSD space/1.5TB traffic/KVM/Hong Kong HKBN

Recommend

BOLTVM: $8/year/256MB memory/10GB SSD space/250GB bandwidth/openvz

Aiba has introduced it twice, and it has the late...

MicroNodes: $2.8/month/512MB memory/30GB space/500GB bandwidth/KVM/Dallas

MicroNodes, a newly established American hosting ...

A400 Interconnect 2 Cores 4GB Memory 50Mbps Port Los Angeles 9929 KVM VPS Review

Details : A400 interconnection: 129 yuan/year/1 c...

50kvm: $4.5/month/512MB RAM/5GB SSD space/1TB bandwidth/KVM/Portland

50kvm, a subsidiary of Wuling Network, has been i...

SteadyTurtle: $11.70/year for shared hosting, free GlobalSign SSL certificate

SteadyTurtle, has 4 years of experience in the ho...

PieLayer: $48/year/6GB memory/40GB SSD space/4TB bandwidth/KVM/Germany

PieLayer has been introduced many times in the ho...