Yes, there's a mistake. The record you you are thinking of,
ns.example.local IN A 192.168.4.100
is interpreted as ns.example.local.example.local
instead. To fix, either add the dot, making the identifier fully qualified:
ns.example.local. IN A 192.168.4.100
clientlongname.example.local. IN A 192.168.4.97
client2.example.local. IN A 192.168.4.98
client3.example.local. IN A 192.168.4.99
client4.example.local. IN A 192.168.4.96
or remove suffix, leveraging the set origin:
ns IN A 192.168.4.100
clientlongname IN A 192.168.4.97
client2 IN A 192.168.4.98
client3 IN A 192.168.4.99
client4 IN A 192.168.4.96
or, fix all the record simultaneously by setting the origin to DNS root at the beginning of the zone or at least, before first non-qualified record:
$ORIGIN .
I prefer to remove extra suffices and usually choose second way: to leverage the origin.
In DNS there is a distinction between records written with dot at the end, which are considered fully qualified identifiers, and those where there is no dot at the end.
Fully qualified are read and interpreted immediately as is. For example, a dot alone .
(the DNS root), and example.com.
.
Non-qualified identifiers are resolved with respect to current origin. At the start of zone origin is set to the zone name in BIND, in your case, example.local
for the first zone and 4.168.192.in-addr.arpa
for a second zone. Then, when each record is parsed, if there are non-qualified names, origin is appended. This happens both with record names (as it was with your case with ns.example.local
) and with record data, for example, with target names inside CNAME, PTR, SOA, NS, MX, SRV and other records. For example, if you don't change the origin before SOA, the record
@ IN SOA ns root 7 604800 86400 2419200 604800
will be interpreted exactly the same as current SOA record in your zone — both ns
and root
will have the origin appended. This is also the reason why almost always PTR records in reverse zones are spelled with the dot at the end — we don't normally want them to be interpreted into names like foo.bar.x.y.z.in-addr.arpa.
, but to foo.bar.
. You can change the origin anytime within the zone file, and new value will be used for all subsequent records, until changed again.