1

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.

HBruijn
  • 72,524
  • 21
  • 127
  • 192
WoJ
  • 3,365
  • 8
  • 46
  • 75

2 Answers2

5

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
HBruijn
  • 72,524
  • 21
  • 127
  • 192
  • 1
    That said, I'd strongly discourage using `$ORIGIN` in this way. It violates the [principle of least astonishment](https://en.wikipedia.org/wiki/Principle_of_least_astonishment) as the new origin will always result in out-of-zone data when used in the left hand side of the record definition. This is particularly egregious when you consider that the target (right hand side) of a DNS record is not always a name, but the left side will *always* be. – Andrew B Dec 08 '16 at 04:35
  • 1
    @AndrewB I agree that redefining $ORIGIN is not a very intuitive thing to do, but AFAIK it **is** allowed but I will add a warning tha it is a bad idea... – HBruijn Dec 08 '16 at 17:04
-2

you need to edit /etc/bind/named.conf.local add your addr PTR zone :

zone "9.0.10.in-addr.arpa" { type master; file "/etc/bind/db.10.10.10"; };

create file db.10.10.10 vi db.10.10.10

add this : $TTL 3D @ IN SOA srv.example.com. root.example.com. ( 2 ; Serial 8H ; Refresh 2H ; Retry 4W ; Expire 1D) ; Minimum TTL @ IN NS srv.example.com. 254 IN PTR srv.example.com. restart bind9 /etc/init.d/bind9 restart

check with nslookup -q=PTR 10.10.10.254

  • My question was not about how to configure PTR resolution at all (it works according to the examples I provided) but how to set a defualt domain name appended on dot-less PTR entries. – WoJ Dec 07 '16 at 11:11