How to Install Bind DNS Server on CentOS and RHEL

In web hosting, the Domain Name System (DNS) plays a pivotal role in ensuring seamless user experience. The DNS translates human-friendly domain names into IP addresses that computers use to communicate.

BIND (Berkeley Internet Name Domain) is a widely used DNS software on the internet that provides a robust and stable platform on top of which organizations can build distributed computing systems with the knowledge that those systems are fully compliant with the highest DNS standards.

This quick guide will walk you through the process of installing BIND DNS on CentOS or Red Hat Enterprise Linux (RHEL) using the yum command. This tutorial is designed for webmasters and website administrators who are looking to enhance their skills and knowledge in managing DNS servers.

Before we dive in, you might want to explore more about the differences between various server types such as dedicated or virtual servers.

Let’s get to the step-by-step tutorial to install BIND DNS on CentOS or RHEL.

Step 1: Install BIND-chroot Package

The first step in installing BIND DNS on CentOS or RHEL is to install the bind-chroot package. This package is necessary as it allows BIND to run in a chroot environment, enhancing the security of your DNS server.

To install the bind-chroot package, you need to run the following command:

[root@server ~]# yum install bind-chroot

This command will initiate the installation process. The system will load plugins, resolve dependencies, and start the transaction check. Once the transaction check is complete, the system will ask for your confirmation to proceed with the installation.

You will see a prompt asking “Is this ok [y/N]:”. Type ‘y’ and press enter to proceed with the installation.

The system will then download the necessary packages and install them. Once the installation is complete, you will see a message indicating that the bind-chroot and bind packages have been installed.

[root@server ~]# yum install bind-chroot
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: ftp.oss.eznetsols.org
 * base: ftp.oss.eznetsols.org
 * contrib: ftp.oss.eznetsols.org
 * extras: ftp.oss.eznetsols.org
 * updates: ftp.oss.eznetsols.org
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-chroot.x86_64 30:9.3.6-4.P1.el5_5.3 set to be updated
--> Processing Dependency: bind = 30:9.3.6-4.P1.el5_5.3 for package: bind-chroot
--> Running transaction check
---> Package bind.x86_64 30:9.3.6-4.P1.el5_5.3 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch         Version                     Repository     Size
================================================================================
Installing:
 bind-chroot       x86_64       30:9.3.6-4.P1.el5_5.3       updates        44 k
Installing for dependencies:
 bind              x86_64       30:9.3.6-4.P1.el5_5.3       updates       986 k

Transaction Summary
================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)

Total download size: 1.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): bind-chroot-9.3.6-4.P1.el5_5.3.x86_64.rpm         |  44 kB     00:00
(2/2): bind-9.3.6-4.P1.el5_5.3.x86_64.rpm                | 986 kB     00:09
--------------------------------------------------------------------------------
Total                                            85 kB/s | 1.0 MB     00:12
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : bind                                                     1/2
  Installing     : bind-chroot                                              2/2

Installed:
  bind-chroot.x86_64 30:9.3.6-4.P1.el5_5.3

Dependency Installed:
  bind.x86_64 30:9.3.6-4.P1.el5_5.3

Complete!

Step 2: Configure BIND DNS Server

After installing the bind-chroot package, the next step is to configure the BIND DNS server. Before making any changes, it’s recommended to create a backup of the original configuration file. This can be done using the following command:

# cp /etc/named.conf /etc/named.bak

Open the configuration file using your preferred text editor:

# vim /etc/named.conf

In the ‘Options’ section, comment out the lines that restrict the BIND DNS server to listen only to localhost. This allows the server to listen to all IPs:

// listen-on port 53 { 127.0.0.1; }; 
// listen-on-v6 port 53 { ::1; };

Next, adjust the allow-query parameter according to your network subnet. This setting allows only the hosts in the defined network to access the DNS server:

allow-query { localhost; 192.168.54.0/24; };

Step 3: Create a Forward DNS Zone File for the Domain

A forward lookup DNS zone is one that stores the host name IP address relationship. When queried, it gives the IP address of the host system using the host name. To define the forward lookup zone, create a new file and add the necessary configurations:

[root@server ~]# vim /var/named/webhostinggeeks.local.db

Step 4: Create a Reverse DNS Zone File for the Domain

Similarly, a reverse DNS zone returns the Fully Qualified Domain Name (FQDN) of the server in relation to its IP address. To define the reverse lookup zone, create a new file and add the necessary configurations:

[root@server ~]# vim /var/named/webhostinggeeks.local.rev

After creating the forward and reverse DNS zone files, assign the necessary file permissions:

# chown named:named /var/named/webhostinggeeks.local.db
# chown named:named /var/named/webhostinggeeks.local.rev

Step 5: Test the BIND DNS Server from a Client System

After finalizing the configuration on the DNS server, test the BIND DNS server from a client system. On a client machine (CentOS 8 / RHEL 8), open the /etc/resolv.conf file and edit the following parameter:

nameserver 192.168.54.55

Finally, use the nslookup command to test the BIND DNS server:

# nslookup dns-primary.webhostinggeeks.local
# nslookup mail.webhostinggeeks.local
# nslookup www.webhostinggeeks.local
# nslookup ftp.webhostinggeeks.local
# nslookup 192.168.54.55

Commands Mentioned

  • yum install bind-chroot – This command is used to install the bind-chroot package on CentOS or RHEL.
  • cp /etc/named.conf /etc/named.bak – This command is used to create a backup of the original configuration file.
  • vim /etc/named.conf – This command isused to open the configuration file in the vim editor.
  • vim /var/named/webhostinggeeks.local.db – This command is used to create and open the forward DNS zone file.
  • vim /var/named/webhostinggeeks.local.rev – This command is used to create and open the reverse DNS zone file.
  • chown named:named /var/named/webhostinggeeks.local.db – This command is used to change the ownership of the forward DNS zone file to the named user and group.
  • chown named:named /var/named/webhostinggeeks.local.rev – This command is used to change the ownership of the reverse DNS zone file to the named user and group.
  • nslookup dns-primary.webhostinggeeks.local – This command is used to test the DNS resolution of the primary DNS server.
See also  How to Lock and Unlock Zimbra Accounts from Command Line

Conclusion

Setting up a BIND DNS server on CentOS or RHEL involves several steps, including installing the bind-chroot package, configuring the BIND DNS server, creating the forward and reverse DNS zone files, and testing the server from a client system. This comprehensive guide provides detailed instructions for each step, helping you to successfully set up a BIND DNS server.

Remember, a well-configured DNS server is crucial for the smooth operation of your network. It not only ensures that hostnames and IP addresses are correctly resolved, but also enhances the overall performance and security of your network.

See also  Prerequisites Checking Before Install Zimbra Collaboration Suite 8 on CentOS 6.3

Whether you’re a seasoned webmaster or a beginner, this guide provides valuable insights into the process of setting up a BIND DNS server. Keep exploring, keep learning, and keep pushing the boundaries of your knowledge.

Understanding how to install and manage DNS servers is a valuable skill for webmasters and website administrators. It not only helps in enhancing the user experience but also plays a crucial role in the overall performance and security of your website.

Note, that choosing the right web server is also an essential part of web hosting. Whether it’s Apache, Nginx, or LiteSpeed, each server has its own set of features and benefits.

Hope this guide has been helpful in your journey to becoming a more proficient webmaster or website administrator.

See also  How to Create an Archive using tar Command in Linux

Keep exploring, keep learning, and keep pushing the boundaries of your knowledge.

FAQ

  1. What is BIND DNS?

    BIND (Berkeley Internet Name Domain) is an open-source DNS server that provides a robust platform for organizations to build distributed computing systems. It is compliant with the highest DNS standards and is widely used on the internet.

  2. What is the purpose of the bind-chroot package?

    The bind-chroot package is used to enhance the security of your DNS server. It allows BIND to run in a chroot environment, which isolates the DNS server from the rest of the system, thereby limiting the potential damage in case of a security breach.

  3. What is CentOS and RHEL?

    CentOS and RHEL (Red Hat Enterprise Linux) are popular distributions of the Linux operating system. They are widely used in enterprise environments due to their stability, security, and robust set of features.

  4. What is the yum command used for?

    The yum command is a package management utility for RPM-compatible Linux operating systems such as CentOS and RHEL. It is used to install, update, and remove software packages.

  5. Why is DNS important in web hosting?

    DNS plays a crucial role in web hosting as it translates human-friendly domain names into IP addresses that computers use to communicate. Without DNS, users would have to remember complex IP addresses to access websites, which is not practical.

  6. What is the purpose of the forward and reverse DNS zone files?

    The forward DNS zone file is used to map hostnames to their corresponding IP addresses, while the reverse DNS zone file is used to map IP addresses back to their corresponding hostnames.

  7. What is the nslookup command used for?

    The nslookup command is used to query the DNS server and check the mapping between a hostname and its corresponding IP address, or vice versa.

  8. Why is it important to test the BIND DNS server from a client system?

    Testing the BIND DNS server from a client system helps to ensure that the server is correctly resolving hostnames to their corresponding IP addresses and vice versa. It verifies that the server is functioning as expected and is ready to handle DNS queries.

Comments

Leave a Reply

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