Skip to content

Cloudflare DDNS bash Script for most Linux distributions and MacOS. Choose any source IP address to update external or internal (WAN/LAN). Cloudflare's options proxy and TTL configurable via the parameters.

Notifications You must be signed in to change notification settings

IsaacFL/cloudflareDDNS-Bash

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cloudflare DDNS - Simple Bash Script

contributions welcome MIT license

Cloudflare DDNS bash Script for most Linux distributions and MacOS.
Choose any source IP address to update external or internal (WAN/LAN).
Cloudflare's options proxy and TTL configurable via the parameters.
PowerShell Script for Windows can be found here

Requirements

  • curl
  • api-token with ZONE-DNS-EDIT Permissions
  • DNS Record must be pre created (api-token should only edit dns records)

Installation

wget https://raw.githubusercontent.com/IsaacFL/cloudflareDDNS-Bash/main/updateDNS6.sh
sudo chmod +x updateDNS6.sh
sudo mv updateDNS6.sh /usr/local/bin/updateDNS6

Parameters

Update the config parameters

sudo nano /usr/local/bin/updateDNS6
Option Example Description
what_ip internal Which IP should be used for the record: internal/external
what_interface eth0 For internal IP, provide interface name
dns_record ddns.example.com DNS AAAA record which will be updated
zoneid ChangeMe Cloudflare's Zone ID
proxied false Use Cloudflare proxy on dns record true/false
ttl 120 120-7200 in seconds or 1 for Auto
cloudflare_api_token ChangeMe Cloudflare API Token KEEP IT PRIVATE!!!!

Running The Script

updateDNS6

Automation With Crontab

You can run the script via crontab

crontab -e

Here are some Examples

Run every minute

* * * * * /usr/local/bin/updateDNS6

Run every 5 minutes

*/5 * * * * /usr/local/bin/updateDNS6

Run at boot

@reboot /usr/local/bin/updateDNS6

Run 1 minute after boot

@reboot sleep 60 && /usr/local/bin/updateDNS6

Run at 08:00

0 8 * * * /usr/local/bin/updateDNS6

License

MIT License

Copyright© 3os.org @2020

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Cloudflare DDNS bash Script for most Linux distributions and MacOS. Choose any source IP address to update external or internal (WAN/LAN). Cloudflare's options proxy and TTL configurable via the parameters.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%