Own DNS server not working (SERVFAIL when trying to find out the host’s IP)… here is a solution to the problem.
Own DNS server not working (SERVFAIL when trying to find out the host’s IP)
I have set up a DNS server on the virtual machine. When I use host with IP address, it works fine (101.48.168.192.in-addr.arpa domain name pointer
s1.home.lan.), but when I try to get the IP of the domain (e.g. host
s1.home.lan), I get Host s1.home.lan
not found: 2(SERVFAIL)
。 What is wrong configuration?
Profile:
Named .conf.local:
zone "home.lan" {
type master;
file "/etc/bind/zones/home.lan.db";
};
zone "48.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.48.168.192.in-addr.arpa";
};
home.lan.db:
$ORIGIN .
$TTL 3600
home.lan. IN SOA ubuntu.home.lan. hostmaster.home.lan (
2002010101 ; serial
8H ; refresh
4H ; retry
4W ; expire
1D ; minimum
)
home.lan. IN NS ubuntu.home.lan.
home.lan. IN MX 10 ubuntu.home.lan.
$ORIGIN home.lan.
localhost IN A 127.0.0.1
s1 IN A 192.168.48.101
s2 IN A 192.168.48.102
s3 IN A 192.168.48.103
rev.48.168.192.in-addr.arpa:
@ IN SOA ubuntu.home.lan. hostmaster.home.lan. (
2002010101 ; serial
8H ; refresh
4H ; retry
4W ; expire
1D ; minimum
)
IN NS ubuntu.home.lan.
101 IN PTR s1.home.lan.
102 IN PTR s2.home.lan.
103 IN PTR s3.home.lan.
Solution
You are defining the zone home.lan, specifying the host ubuntu.home.lan
as MX and NS, but there is no A record for ubuntu.home.lan in your home.lan zone.