I am completely new to DNS servers and as an educational tool, I have installed bind9 on a RPi running dietpi - a stripped down version of Debian.
External addresses resolve perfectly but internal ones do not. I have a db.local.lan file set up like this:
$TTL 3D
$ORIGIN local.lan.
local.lan. IN SOA dietpi.local.lan. hostmaster.local.lan. (
2020100418 ; serial
8H ; refresh
4H ; retry
4W ; expire
1D ; minimum
)
local.lan. IN NS dietpi.local.lan.
local.lan. IN MX 10 dietpi.local.lan.
localhost IN A 127.0.0.1
dietpi IN A 192.168.20.254
router IN A 192.168.20.1
NL1901ACV IN A 192.168.20.1
named.conf.local is like this:
//
// Do any local configuration here
//
zone "local.lan" IN {
type master;
file "/etc/bind/db.local.lan";
};
zone "20.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.rev.20.168.192.in-addr.arpa";
};
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
I have a pc set up to use this device as it's dns server. from this pc I can ping google.com, but if I try to ping dietpi or dietpi.local.lan I get a host not found error.
named-checkconf reveals no errors.
named-checkconf -z returns the following - I have no idea what this means!
/etc/bind/db.local.lan:10: unknown RR type 'local.lan.'
/etc/bind/db.local.lan:11: unknown RR type 'local.lan.'
/etc/bind/db.local.lan:12: unknown RR type 'localhost'
/etc/bind/db.local.lan:13: unknown RR type 'dietpi'
/etc/bind/db.local.lan:14: unknown RR type 'router'
/etc/bind/db.local.lan:15: unknown RR type 'NL1901ACV'
zone local.lan/IN: loading from master file /etc/bind/db.local.lan failed: unknown class/type
zone local.lan/IN: not loaded due to errors.
_default/local.lan/IN: unknown class/type
/etc/bind/db.rev.20.168.192.in-addr.arpa:1: no TTL specified; using SOA MINTTL instead
/etc/bind/db.rev.20.168.192.in-addr.arpa:10: TTL set to prior TTL (1)
zone 20.168.192.in-addr.arpa/IN: loaded serial 2020100417
zone localhost/IN: loaded serial 2
zone 127.in-addr.arpa/IN: loaded serial 1
zone 0.in-addr.arpa/IN: loaded serial 1
zone 255.in-addr.arpa/IN: loaded serial 1
Can anyone explain what I am doing wrong?
Thanks in advance. David.
Remove the spaces from the beginnning of the host entries in the zone file.
The problem here is if a line starts with a whitespace, then the line is supposed to refer to the previous entry. In this case, you should not specify the name, because it is already given. Also, you don't need the
IN
s in the zone file.This zone file should work:
Notice that the first two entries have spaces at the beginning. This makes the entries refer to the previous entry, i.e. the zone itself. Since this reference is given by the leading blank in the line, no name should be specified in those entries. The entries in the rest of the file refer to separate records, so they do have a name, and don't have a leading space.