Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 1.84 KB

File metadata and controls

52 lines (43 loc) · 1.84 KB

digitalocean openwrt ddns updater

This script might be a useful for you if you use Digital Ocean as name server and you would update your OpenWRT based hosts with dynamic IP address.

how to create a new sub domain

TOKEN='digital_ocean_auth_token'
IPV4_ADDR='ipv4_addr' 
DOMAIN='your.sub.domain.tld'

DATA='{"name":"'${DOMAIN}'","ip_address":"'$IPV4_ADDR'"}'

wget \
  -O - \
  --quiet \
  --save-header \
  --no-check-certificate \
  --method="POST" \
  --header="Content-Type: application/json" \
  --header="Authorization: Bearer ${TOKEN}" \
  --body-data=${DATA} "https://api.digitalocean.com/v2/domains"

how to determine record id

TOKEN='digital_ocean_auth_token'
DOMAIN='your.sub.domain.tld'

wget \
  -O - \
  --quiet \
  --no-check-certificate \
  --method="GET" \
  --header="Content-Type: application/json" \
  --header="Authorization: Bearer ${TOKEN}" \
  "https://api.digitalocean.com/v2/domains/${DOMAIN}/records" | jq '' | grep -B 1 '"type": "A"'
  

configuration

luci setting name config file key value
DDNS Service provider [IPv4] --custom--
Custom update-script update_script full path to updater script (eg: /root/ddns_digitalocean.sh)
Hostname/Domain domain your domain or sub domain
Username username record id of your domain or sub domain
Password auth_token your Digital Ocean authentication token

detailed info: