How to append a domain to a PTR resolution?

I have a bind9 server authoritative for my domain example.com. Forward resolution works, PTRs as well up to a point.

I currently have

254.10.10   IN  PTR srv.

in my PTR zone for 10.x, which correctly resolves to

root@srv ~# dig -x 10.10.10.254
(...)
;; ANSWER SECTION:
254.10.10.10.in-addr.arpa. 604800 IN    PTR     srv.

I would like the resolution to be a FQDN and therefore replaced srv. by srv (removed the dot) in the configuration above, leading to a resolution of

root@srv ~# dig -x 10.10.10.254
(...)
;; ANSWER SECTION:
254.10.10.10.in-addr.arpa. 604800 IN    PTR     srv.10.in-addr.arpa.

How can I inform bind9 to resolve 10.10.10.254 into srv.example.com instead of srv.10.in-addr.arpa?

Note: I know that I could have

254.10.10   IN  PTR srv.example.com.

in my configuration. What I am looking for is how to set the default appended domain.


As far as I know Bind will only append/substitute the implicit zone name 10.10.10.in-addr.arpa. or the explicit value of $ORIGIN (which usually would also be the zone name 10.10.10.in-addr.arpa.) when the trailing dot . is missing or when the @ shorthand is used.

You will need to use FQDN's and can't use any shorthand.

Or rather you can't expect to use different shorthands to be used for the resource record and it's value.

A typical reverse zone looks like:

$ORIGIN 1.0.10.in-addr.arpa.
$TTL 86400
@     IN     SOA    dns1.example.com.     hostmaster.example.com. (
                    2001062501 ; serial
                    21600      ; refresh after 6 hours
                    3600       ; retry after 1 hour
                    604800     ; expire after 1 week
                    86400 )    ; minimum TTL of 1 day

      IN     NS     dns1.example.com.
      IN     NS     dns2.example.com.

20    IN     PTR    alice.example.com.
21    IN     PTR    betty.example.com.
22    IN     PTR    charlie.example.com.
23    IN     PTR    doug.example.com.
24    IN     PTR    ernest.example.com.
25    IN     PTR    fanny.example.com.

What you can do is change/redefine $ORIGIN - the domain name that gets used/appended to unqualified records, such as those with the hostname and nothing more. You can even change $ORIGIN multiple times...

Although technically this should work as intended it is a very uncommon approach and likely to introduce human error and overall a Bad IdeaTM

The following means that you can't use 25 anymore but will need to use the FQDN 25.1.0.10.in-addr.arpa. as the RR, but you can use short hostnames for the actual hosts.

$ORIGIN 1.0.10.in-addr.arpa.
$TTL 86400
@     IN     SOA    dns1.example.com.     hostmaster.example.com. (
                    2001062501 ; serial
                    21600      ; refresh after 6 hours
                    3600       ; retry after 1 hour
                    604800     ; expire after 1 week
                    86400 )    ; minimum TTL of 1 day

      IN     NS     dns1.example.com.
      IN     NS     dns2.example.com.

$ORIGIN example.com.
20.1.0.10.in-addr.arpa.    IN     PTR    alice
21.1.0.10.in-addr.arpa.    IN     PTR    betty
22.1.0.10.in-addr.arpa.    IN     PTR    charlie
23.1.0.10.in-addr.arpa.    IN     PTR    doug
24.1.0.10.in-addr.arpa.    IN     PTR    ernest
25.1.0.10.in-addr.arpa.    IN     PTR    fanny

$ORIGIN example.co.uk.
26.1.0.10.in-addr.arpa.    IN     PTR    geoff
27.1.0.10.in-addr.arpa.    IN     PTR    honey