Skip to content

Latest commit

 

History

History
29 lines (26 loc) · 1.21 KB

README.md

File metadata and controls

29 lines (26 loc) · 1.21 KB

DdnsOnCloudFlare

A shell script to automatic update cloudFlare dns record whit actual external ip address, leveraging the official CloudFlare api.

Guide

Pre-work

  • Have a domain and use Cloudflare's nameserver.
  • Find your ZoneId from the [overview] page of you domain.
  • Create an api token. You can find it from Here
  • Clone this project to local, fill in config.conf. In which, zoneId and apiKey refer to the contents you just got in the above steps. recordNameis the dns record name you'd like to operate.

Update Ipv4 record

Simply run:

sh ./updateIpv4.sh

This will first get your external ipv4 address, and synchronize to the dns record.
If no such record exists, will create one.
If the record is already set as the expected ip, will do nothing. Or, the record will be updated.

Update Ipv6 record

Similar to the previous, but just run:

sh ./updateIpv6.sh

The behavior is also the same.

Note

  • You can make it periodically executed using crontab.
  • DO NOT abuse. According to the term of cloudflare, the api call rate is limited to 1200 requests every 5 minutes.