/dyndns-pdns

Dynamic DNS Collector for PowerDNS

Primary LanguageGoMIT LicenseMIT

Dynamic DNS Collector for PowerDNS

Collects IPv4/IPv6 addresses of network devices (routers, firewalls etc.) and writes the corresponding PowerDNS resource records.

Go Report Card

Setup

Install from source

You need go and GOBIN in your PATH. Once that is done, install dyndns-pdns using the following command:

go get -u github.com/joeig/dyndns-pdns/cmd/dyndns-pdns

After that, copy config.dist.yml to config.yml, replace the default settings and run the binary:

dyndns-pdns -config=/path/to/config.yml

If you're intending to add the application to your systemd runlevel, you may want to take a look at init/dyndns-pdns.service.

Usage

Update IP addresses of a certain host

In order to update the IP address of a certain host, you can choose between to ingest modes:

  • Use the value provided by a HTTP GET parameter (IPv4 and/or IPv6)
  • Use the value provided by the TCP remote address field (either IPv4 or IPv6, depending on the client's capabilities)

This tool does not support the DDNS protocol (RFC2136), which is supported by PowerDNS out of the box.

HTTP GET parameter

Suitable for all common network devices.

http "https://dyn-ingest.example.com/v1/host/<device name>/sync?key=<key>&ipv4=<IPv4 address>&ipv6=<IPv6 address>"

You have to provide at least one IP address family.

TCP remote address

If your router doesn't know its own egress IP address (might be the most promising solution for people that have to work behind NAT gateways or proxies).

http "https://dyn-ingest.example.com/v1/host/<device name>/sync?key=<key>"

This option takes the IP address (IPv4 or IPv6) used by the client during the TCP handshake.

Comment regarding the update process

The PowerDNS API is not transaction safe. Existing resource record entries, which belong to a specific host, are dropped, before the new IP addresses are inserted for that host. Due to potential delays between the "delete" step and the "add" step, there is a risk that the dynamic DNS hostname might become unavailable. In order to lower the impact caused by this behaviour, it is recommended to set your negative caching TTL to a low value.

Examples

Fritzbox (FritzOS)

Your Fritzbox configuration might look like this:

Key Value
Provider Custom
Update URL https://dyn-ingest.example.com/v1/host/\<username>/sync?key=<pass>&ipv4=<ipaddr>&ipv6=<ip6addr>
Domain name fb-home.dyn.example.com
Username fb-home
Password my secret password

You have to copy the update URL as it is, including all the placeholders and <> brackets. They will be substituted by FritzOS internally with the corresponding values.

The key table item should be as following:

keyTable:
- name: "fb-home"
  enable: true
  key: "my secret password"
  hostName: "fb-home"
  ingestMode: "getParameter"