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

AlphaSSL SSL Offer: $8/5 Years

You read it right, it’s 8 US dollars for 5 years,...

Cloudflexy/dedicenter 1GB RAM/10GB SSD space Los Angeles KVM VPS review

Details: Cloudflexy: $9.99/year/1GB memory/100GB ...

Tilaa: €6/month/1GB memory/20GB space/unlimited traffic/1Gbps/KVM/Netherlands

Tilaa, a long-established Dutch business, was fou...

HudsonValleyHost: $5/month/4GB RAM/300GB storage/5TB traffic/OpenVZ/Los Angeles

HudsonValleyHost, owned by cc, is a stable mercha...

MacHost: $50/month/E5345/8GB RAM/1TB HDD/unlimited traffic/5 IPs/Chicago

MacHost, a newly established American hosting pro...

OdIndex: OneDrive list program based on PHP

OdIndex Features : Automatically renew the token ...

Tencent Cloud: Free 100 yuan voucher without threshold, 500-200 voucher

Tencent Cloud, 2019 Techo Developer Conference, g...

RamNode: $5.25/month/15GB SSD space/unlimited traffic/Atlanta/Netherlands

RamNode, vps is quite stable and the price is fir...