Skip to content
Automatic on-the-fly IPv6 PTR record plugin for CoreDNS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Some services require that a RDNS request resolves to a PTR record. With this CoreDNS plugin, you can generate these PTR records on the fly based on the requested IPv6 address. The plugin translates the requested address and appends a suffix. Additionally, you can create a so-called presets file to answer with a "real" record if a specific request is received.


  1. 2001:db8:300:b002:5054:ff:fe4b:db44 could be translated to 20010db80300b002505400fffe4bdb44.mydomain.tld
  2. 2001:db8:300:b002:5054:ff:fe4b:db45 could be translated to myhost.mydomain.tld via the presets file


Each line in a presets file contains a manual override seperated by a comma. The first part contains the request and the second part contains the value which should be returned. For example:;myhost.mydomain.tld;firewall.mydomain.tld

Translation process

Let's say the plugin receives a PTR request for If there is a preset found the preset value will be used in the anwer. If there is none the regular translation process starts:

  1. Strip 4.4.b.d.b.4.e.f.f.f.
  2. Remove all dots: 44bdb4efff004505200b00308bd01002
  3. Reverse the string: 20010db80300b002505400fffe4bdb44
  4. Append the suffix and return the result: 20010db80300b002505400fffe4bdb44.mydomain.tld

Corefile example

Possible plugin arguments:

Argument Default value Description
suffix The suffix to append when regular translating happens
 presetsfile The absolute path to the presets file
ttl 900 The TTL value the answer should have in seconds

Let's say your provider allocated 2001:db8:300:b000::/56 to you. You sliced two subnets out of it:

  1. 2001:db8:300:b000::/64 => lan.myhost.tld
  2. 2001:db8:300:b001::/64 => servers.myhost.tld

You Corefile would look something like this: {
    autoipv6ptr {
        suffix lan.mydomain.tld
} {
    autoipv6ptr {
        suffix servers.mydomain.tld
        presetsfile /var/lib/coredns/presets.servers.mydomain.tld
        ttl 60

The suffix is a mandatory argument. The presetsfile is optional. The presets file is read on plugin startup.

You can’t perform that action at this time.