Software & AppsOperating SystemLinux

Fixing “server can’t find PTR record: NXDOMAIN” Error in BIND DNS Server on Ubuntu

Ubuntu 14

In this article, we will delve into the topic of fixing the “server can’t find PTR record: NXDOMAIN” error in BIND DNS Server on Ubuntu. This error typically occurs when the DNS server is unable to find the PTR record for a given IP address, resulting in an NXDOMAIN (Non-Existent Domain) error.

Quick Answer

To fix the "server can’t find PTR record: NXDOMAIN" error in BIND DNS Server on Ubuntu, you need to modify the reverse zone file by referring to only the last octet of the IP address. Then, restart the BIND service and test the configuration using the nslookup command. Make sure the DNS server is running properly and the domain’s configuration file is correctly set up.

Understanding the Error

Before we dive into the solution, it’s important to understand what the error means. The NXDOMAIN error is a standard DNS status code that signifies that the domain does not exist in the DNS records. This error often occurs when there is a misconfiguration in the DNS records or the DNS server.

Prerequisites

Before you begin, make sure that you have:

  • Administrative access to the BIND DNS server.
  • Basic understanding of DNS records and configuration files.

Step 1: Modify the Reverse Zone File

The first step in resolving this error is to modify the reverse zone file. The reverse zone file is typically named db.192 (or similar) and is located in the /etc/bind/ directory on the DNS server.

Open the reverse zone file with a text editor:

sudo nano /etc/bind/db.192

In this file, you will see an entry that looks like this:

176.190.168 IN PTR example.com.

This line is meant to map the IP address 192.168.190.176 to the domain example.com. However, in the reverse zone file, you should only refer to the last octet of the IP address. Therefore, you need to change this line to:

176 IN PTR example.com.

Here, 176 is the last octet of the IP address, IN stands for Internet, PTR is the DNS record type that is used to reverse map the IP address to the domain, and example.com is the domain name.

Save and close the file.

Step 2: Restart the BIND Service

After modifying the reverse zone file, you need to restart the BIND service to apply the changes. You can do this by running the following command:

sudo service bind9 restart

Here, sudo is used to run the command with root privileges, service is a utility to run system services, bind9 is the name of the BIND service, and restart is the action to perform.

Step 3: Test the Configuration

Now that you have made the necessary changes, it’s time to test the configuration. On the client machine, run the nslookup command:

nslookup 192.168.190.176

This command should now return the corresponding hostname for the IP address, indicating that the PTR record has been found.

If you still encounter a SERVFAIL error when trying to resolve a domain, it could be due to incorrect configuration or connectivity issues. Make sure that the DNS server is running properly and that the db.example.com file is correctly configured with the appropriate A and AAAA records for the example.com domain.

For more detailed information about the DNS resolution process and any errors encountered, you can use the dig command:

dig example.com

Conclusion

In this article, we have covered how to fix the “server can’t find PTR record: NXDOMAIN” error in BIND DNS Server on Ubuntu. The steps involved modifying the reverse zone file, restarting the BIND service, and testing the configuration. If you follow these steps carefully, you should be able to resolve this error and ensure that your DNS server is functioning correctly.

Remember to always check your firewall settings as they can sometimes interfere with DNS queries. If you encounter any issues or have any questions, feel free to leave a comment below.

What is BIND DNS Server?

BIND (Berkeley Internet Name Domain) is an open-source DNS software that provides the functionality of a DNS server. It is widely used on Unix-like operating systems, including Ubuntu, to translate domain names into IP addresses and vice versa.

How can I check if BIND DNS Server is installed on my Ubuntu system?

You can check if BIND DNS Server is installed on your Ubuntu system by running the following command in the terminal: named -v. If BIND is installed, it will display the version number. If it is not installed, you will receive an error message.

Can I use a different text editor instead of nano to modify the reverse zone file?

Yes, you can use any text editor of your choice to modify the reverse zone file. Simply replace nano with the command to open the file in your preferred text editor.

How do I find the reverse zone file on my Ubuntu system?

The reverse zone file is typically located in the /etc/bind/ directory on the Ubuntu system. Look for a file named db.192 or a similar name. You can use the ls command to list the files in the directory and locate the reverse zone file.

What should I do if I encounter a `SERVFAIL` error after making the changes?

If you encounter a SERVFAIL error after making the changes, it could indicate an incorrect configuration or connectivity issues. Make sure that the DNS server is running properly and that the db.example.com file is correctly configured with the appropriate A and AAAA records for the example.com domain. Additionally, check your network connectivity and firewall settings to ensure that DNS queries are not being blocked.

How can I verify if the changes to the reverse zone file have taken effect?

To verify if the changes to the reverse zone file have taken effect, you can use the nslookup command on the client machine. Run nslookup <IP address> and it should return the corresponding hostname for the IP address if the PTR record has been successfully found and configured.

Are there any additional resources available for troubleshooting DNS issues?

Yes, there are several resources available for troubleshooting DNS issues. The dig command can provide more detailed information about the DNS resolution process and any errors encountered. Additionally, online forums and communities dedicated to DNS and BIND can provide valuable insights and solutions to specific issues you may encounter.

Leave a Comment

Your email address will not be published. Required fields are marked *