
The “Host dns.lan not found: 3(NXDOMAIN)” error is a common issue that system administrators encounter when working with Bind9 DNS servers. This error indicates that the DNS server is unable to resolve the hostname “dns.lan”. In this article, we will walk you through the steps to troubleshoot and fix this issue.
To fix the "Host dns.lan not found: 3(NXDOMAIN)" error in Bind9 DNS Server, you need to check the DNS configuration, verify the zone configuration, check the reverse DNS configuration, verify the DNS resolution order, and test with the dig
command.
Check the DNS Configuration
The first step in resolving this error is to check the DNS server’s configuration.
Step 1: Ensure that the DNS server’s IP address is correctly specified in the /etc/resolv.conf
file on the machine where you are running the host
or nslookup
command. You can check this by running:
cat /etc/resolv.conf
This command displays the contents of the resolv.conf
file, which should contain a line like nameserver 192.168.1.5
, where 192.168.1.5
is the IP address of your DNS server.
Step 2: Verify that the DNS server is running and accessible on the network. You can do this by pinging the server’s IP address:
ping 192.168.1.5
Step 3: Check the configuration files in the /etc/bind
directory. The named.conf.options
file should specify the correct forwarders (other DNS servers that Bind9 can use to resolve queries), and the named.conf.local
file should define the correct zones (domains that Bind9 is responsible for).
Verify the Zone Configuration
The next step is to verify that the zone for the “dns.lan” domain is correctly configured.
Step 1: In the named.conf.local
file, check that the zone “dns.lan” is defined and that the path to the zone file is correct. The zone definition should look something like this:
zone "dns.lan" {
type master;
file "/etc/bind/zones/db.dns.lan";
};
Step 2: Check the zone file (db.dns.lan
) to ensure that it contains the correct DNS records for the “dns.lan” domain. The file should contain an SOA record at the beginning and NS and A records for the “dns.lan” domain.
Check the Reverse DNS Configuration
Reverse DNS is used to map IP addresses back to hostnames. If it is not configured correctly, it could be the cause of the “Host dns.lan not found: 3(NXDOMAIN)” error.
Step 1: In the named.conf.local
file, verify that the reverse zone is defined correctly. The reverse zone definition should look something like this:
zone "1.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/db.192";
};
Step 2: Check the reverse zone file (db.192
) to ensure that it contains the correct PTR records for the IP addresses in the 192.168.1.0/24 subnet.
Verify the DNS Resolution Order
The DNS resolution order, specified in the /etc/resolv.conf
file, determines which DNS servers are queried first. If the order is incorrect, it could lead to the “Host dns.lan not found: 3(NXDOMAIN)” error.
Ensure that the resolv.conf
file has the correct order of DNS servers. It should start with the IP address of your DNS server (192.168.1.5) and then include other servers as failover.
Test with the dig
Command
The dig
command is a powerful tool for testing DNS resolution. Instead of using host
or nslookup
, try using dig
to directly query the DNS server:
dig dns.lan @192.168.1.5
This command sends a DNS query for the “dns.lan” domain to the server at 192.168.1.5. If the server is configured correctly, it should return an A record with the IP address of “dns.lan”.
By following these steps and ensuring the correct configuration of the DNS server, zones, and DNS resolution order, you should be able to resolve the “dns.lan” hostname successfully. If you’re still encountering issues, consider seeking assistance from online communities like Stack Overflow or Server Fault.
This error indicates that the DNS server is unable to resolve the hostname "dns.lan". It means that the DNS server does not have a record for the "dns.lan" domain.
You can check the DNS server’s IP address by looking at the /etc/resolv.conf
file on the machine where you are running the host
or nslookup
command. The file should contain a line like nameserver 192.168.1.5
, where 192.168.1.5
is the IP address of your DNS server.
You can verify if the DNS server is running and accessible by pinging the server’s IP address. Use the command ping 192.168.1.5
, replacing 192.168.1.5
with the IP address of your DNS server. If the server is reachable, it will respond to the ping.
You can check the DNS configuration files in the /etc/bind
directory. The named.conf.options
file should specify the correct forwarders, and the named.conf.local
file should define the correct zones.
In the named.conf.local
file, the zone for the "dns.lan" domain should be defined with the correct path to the zone file. The zone file (db.dns.lan
) should contain the necessary DNS records for the "dns.lan" domain, including an SOA record, NS records, and A records.
Reverse DNS is important because it maps IP addresses back to hostnames. If it is not configured correctly, it can cause issues like the "Host dns.lan not found: 3(NXDOMAIN)" error. It ensures that IP addresses can be resolved to their corresponding hostnames.
The DNS resolution order is specified in the /etc/resolv.conf
file. You can check this file to ensure that it has the correct order of DNS servers. The file should start with the IP address of your DNS server and then include other servers as failover.
You can use the dig
command to test DNS resolution by directly querying the DNS server. Use the command dig dns.lan @192.168.1.5
, replacing dns.lan
with the domain you want to query and 192.168.1.5
with the IP address of your DNS server. The dig
command should return the DNS records for the specified domain if the server is configured correctly.