Skip to content

Instantly share code, notes, and snippets.

View fbatta's full-sized avatar

Francesco Battaglini fbatta

View GitHub Profile
@fbatta
fbatta / cloudflare-ddns-update.sh
Last active September 2, 2022 13:57 — forked from Tras2/cloudflare-ddns-update.sh
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
@fbatta
fbatta / cloudflare_dyndns
Last active November 3, 2022 16:02
Use cloudflare as a dynamic dns with your own domain name (bash script)
#!/bin/bash
## I use this script in a crontab that runs every couple of hours
## Get public IPv4 address with ipify API
PUBLIC_IP=$(curl --request GET --url https://api.ipify.org/)
## Replace auth key with your own cloudflare API key
AUTH_KEY=...
## Replace record name with the name of the (sub)domain you want to assign to the dynamic IP