Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ais-Danny/cloudflare_ddns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Cloudflare DDNS Dynamic Domain Name Resolution

English / [简体中文]

Supports ipv4/ipv6

1. Prepare Parameters

  • API Token
    Obtain it by visiting https://dash.cloudflare.com/profile/api-tokens. Grant the token with DNS modification permissions and read permissions for ZONE and Zone Settings.

  • Email
    Log in to the Cloudflare email account.

  • ZONE_ID
    Zone ID (Go to Cloudflare, click on the corresponding domain, and then click on Overview to find the ID on the bottom right).

# Obtain from https://dash.cloudflare.com/profile/api-tokens
TOKEN="aabbccddeeffgghhllmm"
# Log in to the Cloudflare email account
EMAIL="[email protected]"
# Zone ID (Go to Cloudflare, click on the corresponding domain, and then click on Overview to find the ID on the bottom right)
ZONE_ID="aabbccddeeffgghhllmm"
# Domain to be resolved (e.g., gmail.com or www.gmail.com)
DOMAIN="www.google.com"
# IP type (A/AAAA)
TYPE="AAAA"
DAYS_TO_KEEP=7

2. Set Up Scheduled Task

#Execute
crontab -e
#Insert
# Run every 5 minutes
*/5 * * * * /opt/script/cloudflare_ddns/cloudflare_ddns.sh >/dev/null 2>&1
  1. Attention
  • The domain to be resolved must already exist.
  • Before running, please check if the curl and jq commands are available.
  • Some systems may encounter issues with the curl command (such as certificate not found issues; for OpenWRT, you can use opkg install --force-reinstall ca-bundle to fix it).
  • Since only the IP address and domain name have changed before updating the DNS record, if other configurations are modified, delete the data.json file and restart the script again

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages