Skip to content

n0ctua/hetzner-cloud-dyndns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hetzner Cloud DynDNS

A simple bash script to update DNS records in Hetzner Cloud with your current public IP address. Ideal for dynamic DNS setups.

Requirements

  • curl
  • Hetzner Cloud API token

Configuration

Copy hetzner-cloud-ddns.conf.example to hetzner-cloud-ddns.conf and edit it:

HETZNER_API_TOKEN="your_api_token_here"
ZONE_NAME="example.com"
RECORD_NAME="home"        # use "@" for apex
RECORD_TYPE="A"           # A or AAAA
TTL=""                    # empty = zone default

Make sure to protect the config file: chmod 600 hetzner-cloud-ddns.conf

Usage

# Run with default config (same directory as script)
./hetzner-cloud-ddns.sh

# Run with custom config path
./hetzner-cloud-ddns.sh /path/to/config.conf

Cron Setup

Update every 5 minutes:

*/5 * * * * /path/to/hetzner-cloud-ddns.sh >> /path/to/hetzner-cloud-ddns.log 2>&1

How It Works

  1. Fetches current public IP from multiple sources (failover)
  2. Compares with cached IP to avoid unnecessary API calls
  3. Updates the DNS record via Hetzner Cloud API if changed

API Reference

License

MIT

About

A simple bash script to update DNS records in Hetzner Cloud with your current public IP address. Ideal for dynamic DNS setups.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages