Use CloudFlare API to deploy fixed domain names for dynamic IP VPS/NAT VPS

888u

Last update at :2024-06-03,Edit by888u

Introduced before: using AliDDNS to deploy a fixed domain name for dynamic IP VPS/NAT VPS. This time, we are using CloudFlare API to deploy a fixed domain name for dynamic IP VPS/NAT VPS. Of course, it is still reproduced. Welcome to the TeleGram group discussion: https://t.me/us

1. Method 1 is provided by TG group friends. It is the most convenient. It is recommended to use this one. 1. Enter https://dash.cloudflare.com/profile, check your email, and get the API This is the mailbox Scroll to the bottom to get the API

2. Configure the file and run it

wget --no-check-certificate https://us.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 be your CF mailbox, auth_key to be API KEY, zone_name to be your primary domain name, and record_name to be the secondary domain name you want to use as DDNS (parse it before and fill in 127.0 for the parsing record. 0.1 is fine)

Run the file and go to the CF parser to see if the IP has changed

bashddns.sh

3. Configure Crontab tasks

crontab -e

Add the following code

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

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

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

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

a. Get API KAY

b. Get zone_id

c. Set up domain name resolution to use DDNS

2. Configuration DDNS related

a. Download the file to the server where DDNS is to be deployed

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

b. Edit config.conf

viconfig.conf

Fill in the email, API KAY, and zone_id of the CloudFlare account

c. Get record_id

bash CloudFlare_DDNS_Setter.sh

Enter 1

You will get a piece of code, the id contained in it is the record_id we need

d. Continue editing config.conf

viconfig.conf

Fill in the next three items, the record_id is the one you just obtained, the domain name is the domain name you just parsed, and the ttl is 120.

e. Analyze dynamic VPS IP

bash ddns.sh --ddns

Log in to CloudFlare and check whether the IP is automatically changed to the server’s IP. If 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 is https://sometimesnaive.org/article/5, the project address is https://github.com/nanqinlang-script/CloudFlare_DNS_Record, the picture and text are https://www.neworld.studio/index.php/ archives/93/

Recommended site search: foreign server vps, apply for free space, Foshan high defense server, independent ip space, online personal website generation, Hong Kong virtual host space, virtual host server, all-round virtual host, free cloud host, https proxy ip,

Use CloudFlare API to deploy fixed domain names for dynamic IP VPS/NAT VPS

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码