https://github.com/benyanke/digital-ocean-dns-float
Update Digital Ocean DNS to a dynamic WAN IP with a single CURL
https://github.com/benyanke/digital-ocean-dns-float
dns dynamic-dns networking
Last synced: 10 months ago
JSON representation
Update Digital Ocean DNS to a dynamic WAN IP with a single CURL
- Host: GitHub
- URL: https://github.com/benyanke/digital-ocean-dns-float
- Owner: benyanke
- Created: 2017-03-27T17:22:21.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-02-19T05:51:30.000Z (almost 7 years ago)
- Last Synced: 2025-01-31T13:17:06.793Z (12 months ago)
- Topics: dns, dynamic-dns, networking
- Language: PHP
- Homepage:
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Digital Ocean DNS Update
This script allows remote devices to update DNS A records without needing to give them complete access to the Digital Ocean account with API keys on the client side.
To set up, rename info-example.json to info.json, and add keys and domains.
## Example Server Setup
Given the details in the example json file, a call to the URL below would update server1.example.com and thething.example.org to the public IP address of the client requesting the URL using the API keys listed in the top of the file, and associated with the entry.
~~~~
http(s)://[location-of-script]/?statictoken=pick-any-token-you-wish
~~~~
Additionally, if you want to specify an IP explicitly, you can set the *ip* attribute in the url. For example:
~~~~
http(s)://[location-of-script]/?statictoken=pick-any-token-you-wish&ip=1.2.3.4
~~~~
## Example Client Setup
Because it's simply a web request, a curl command in your cron file can be all you need. For example, the following command would update the IP every 5 minutes. Or, you could pipe the output to a log file if you wish.
~~~ bash
# Update dynamic ip
*/5 * * * * curl http(s)://[location-of-script]/?statictoken=pick-any-token-you-wish >/dev/null 2>&1
~~~
## More Advanced Setup
If you have multiple public interfaces, you could parse the output of `ifconfig` and explicitly specify the IP, to ensure it gets updated correctly, no matter which interface the request goes out. The possibilities are endless.
## Todo
* Read current record value from API instead of DNS query: more robust and lowers load (during DNS propagation delay)
## Miscellany
I wrote this for my own use, and provide no guarantees about it. I'll gladly accept pull requests for feature additions or bug fixes. It works for my own use, and has been running for 2+ years with no issues.