A GNU/Linux Python 3.5+ Dynamic DNS client for your homebrew server.
From Access Your Home Network From Anywhere With Dynamic DNS:
A Local Update Client
If your router doesn’t support DDNS services, you will need a local client to run on a frequently used computer somewhere on your home network. This lightweight little application will check what your IP address is and then phone home to the DDNS provider to update your DDNS record. It’s less ideal than a router-based solution–if the computer isn’t on when your IP address changes, then the record doesn’t get updated–but it’s certainly better than manually editing your DDNS entry.
This tool is the 'Local Update Client' component of the Dynamic DNS hombrew setup.
- Lightweight with no external Python dependencies.
- Simple 'ini style' configuration.
- Avoid writing hard to maintain Dynamic DNS bash scripts.
- Small code base, easy to understand, maintain and extend and is cross platform.
- Will be maintained going forward and is being used in existing homebrew setups.
The following examples were run on a Debian system using the Gandi DNS provider.
Make sure you have the necessary system prerequisites with:
$ sudo apt update
$ sudo apt install -y python3 python3-dev python3-pip
And then install hdyndns
with:
$ sudo useradd -m hdyndns
$ sudo -u hdyndns pip3 install --user hdyndns
If you have an DNS A record for mysite.com
and subdomains foo.mysite.com
and bar.mysite.come
that looks like the following:
@ 1800 IN A 86.91.199.200
foo 1800 IN A 86.91.199.200
bar 1800 IN A 86.91.199.200
Then create a configuration file at /home/hdyndns/.hdyndns/hdyndns.ini
:
[mysite.com]
provider = gandi
api_secret = mySuperSecretApiPassword
subdomains = foo,bar
Finally, add it your root crontab (sudo crontab -e
) to run it every 15 minutes:
*/15 * * * * runuser -l hdyndns -c '$HOME/.local/bin/hdyndns' &>/dev/null
Regarding the &>/dev/null
part, see issue #1.
- Different IP addresses for subdomains are currently not supported.
Please open an issue if you want to collaborate on removing these limitations.
Any DNS provider can be supported if they provide some programmatic way to update their DNS records (for example, if they have a public API). If your current DNS provider is not listed above, please raise an issue. If you'd like to add it yourself, take a look at hdyndns/providers.py. All contributions welcome!
provider
: The DNS provider.api_secret
: The API secret for the DNS provider.subdomains
: Optional comma separated list of subdomains to also update DNS entries for.ttl
: The DNS time to live counter in secods. Default is1800
.
You'll need to install pipenv for development.
You can follow these steps to get a working local installation:
$ pipenv install --dev # install the dependencies
$ pipenv run pip install -e . # install the local hdyndns
$ pipenv run hdyndns --help # check that the local hdynds is working
$ pipenv run tox -e py37 # run the tests on python 3.7 (run `tox -l` to see pythons)
- hack.decentral1.se/decentral1se/hdyndns (primary)
- github.com/decentral1se/hdyndns
- git.coop/decentral1se/hdyndns (deprecated)