Skip to content

nanqinlang-script/CloudFlare_DNS_Record

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

CloudFlare_DDNS_Setter

Build Status language author license

Script to set DDNS Record via CloudFlare

download

mkdir /home/CloudFlare_DDNS
cd /home/CloudFlare_DDNS
wget https://raw.githubusercontent.com/nanqinlang-script/CloudFlare_DNS_Record/Setter/CloudFlare_DDNS_Setter.sh
wget https://raw.githubusercontent.com/nanqinlang-script/CloudFlare_DNS_Record/Setter/config.conf

config

you should write your configuration down to config.conf :

# notice: the following interpretations("# ...") is not allowed in file "config.conf"
# do not write interpretations into config file

# the email address of your cloudflare account
email=

# the zone id of your cloudflare account
zone_id=

# the api key of your cloudflare account
api_key=

# the id of domain record you want to modify
# this id can be find via "get domain record_id" selection in the script
record_id=

# the domain you want to set
domain=

# ttl of record (seconds)
# min value:120
# max value:2147483647
ttl=

take a example, you should write like this:

email=example@gmail.com
zone_id=3456dfdhfi465ff4ae263ef35esd060f
api_key=84058228se28e28898b6ds3ej78yuf2136654

record_id=1d3a9b54623334f3debc20c56eb5585c
domain=example.example.net
ttl=120

usage

step 1

write those config down:

  • email
  • zone_id
  • api_key

step 2

then run

bash CloudFlare_DDNS_Setter.sh

and you will meet select required service :

1.get domain record_id
this function will list all your dns records
you should get the id of a dns record from the list and write it down to record_id in the config file

2.create new domain record
this function can create a new A dns record

step 3

continuously write those config down:

  • record_id
  • domain
  • ttl

step 4

after you finished step 1~3, you will need to run this :

bash CloudFlare_DDNS_Setter.sh --ddns

for above, the parameter --ddns is to update your dns A record to refresh your ddns. Freely let it automatically via such as crontab.

according

中文文档
https://sometimesnaive.org/article/5 (to be updated)

Cloudflare API documentation v4
https://api.cloudflare.com/#zone-properties

About

Script to modify DNS Record via CloudFlare

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages