{"id":348,"date":"2011-02-23T20:50:12","date_gmt":"2011-02-23T12:50:12","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=348"},"modified":"2023-06-23T11:33:51","modified_gmt":"2023-06-23T11:33:51","slug":"how-to-install-bind-dns-server-on-centos-and-rhel","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-bind-dns-server-on-centos-and-rhel\/","title":{"rendered":"How to Install Bind DNS Server on CentOS and RHEL"},"content":{"rendered":"<p>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.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>Before we dive in, you might want to explore more about the differences between various server types such as <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-dedicated-server-hosting\/\">dedicated<\/a> or <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-vps-hosting\/\">virtual<\/a> servers.<\/p>\n<p>Let&#8217;s get to the step-by-step tutorial to install BIND DNS on CentOS or RHEL.<\/p>\n<h2>Step 1: Install BIND-chroot Package<\/h2>\n<p>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.<\/p>\n<p>To install the bind-chroot package, you need to run the following command:<\/p>\n<pre>\r\n[root@server ~]# yum install bind-chroot\r\n<\/pre>\n<p>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.<\/p>\n<p>You will see a prompt asking &#8220;Is this ok [y\/N]:&#8221;. Type &#8216;y&#8217; and press enter to proceed with the installation.<\/p>\n<p>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.<\/p>\n<pre>\r\n[root@server ~]# yum install bind-chroot\r\nLoaded plugins: fastestmirror\r\nLoading mirror speeds from cached hostfile\r\n * addons: ftp.oss.eznetsols.org\r\n * base: ftp.oss.eznetsols.org\r\n * contrib: ftp.oss.eznetsols.org\r\n * extras: ftp.oss.eznetsols.org\r\n * updates: ftp.oss.eznetsols.org\r\nSetting up Install Process\r\nResolving Dependencies\r\n--> Running transaction check\r\n---> Package bind-chroot.x86_64 30:9.3.6-4.P1.el5_5.3 set to be updated\r\n--> Processing Dependency: bind = 30:9.3.6-4.P1.el5_5.3 for package: bind-chroot\r\n--> Running transaction check\r\n---> Package bind.x86_64 30:9.3.6-4.P1.el5_5.3 set to be updated\r\n--> Finished Dependency Resolution\r\n\r\nDependencies Resolved\r\n\r\n================================================================================\r\n Package           Arch         Version                     Repository     Size\r\n================================================================================\r\nInstalling:\r\n bind-chroot       x86_64       30:9.3.6-4.P1.el5_5.3       updates        44 k\r\nInstalling for dependencies:\r\n bind              x86_64       30:9.3.6-4.P1.el5_5.3       updates       986 k\r\n\r\nTransaction Summary\r\n================================================================================\r\nInstall       2 Package(s)\r\nUpgrade       0 Package(s)\r\n\r\nTotal download size: 1.0 M\r\nIs this ok [y\/N]: y\r\nDownloading Packages:\r\n(1\/2): bind-chroot-9.3.6-4.P1.el5_5.3.x86_64.rpm         |  44 kB     00:00\r\n(2\/2): bind-9.3.6-4.P1.el5_5.3.x86_64.rpm                | 986 kB     00:09\r\n--------------------------------------------------------------------------------\r\nTotal                                            85 kB\/s | 1.0 MB     00:12\r\nRunning rpm_check_debug\r\nRunning Transaction Test\r\nFinished Transaction Test\r\nTransaction Test Succeeded\r\nRunning Transaction\r\n  Installing     : bind                                                     1\/2\r\n  Installing     : bind-chroot                                              2\/2\r\n\r\nInstalled:\r\n  bind-chroot.x86_64 30:9.3.6-4.P1.el5_5.3\r\n\r\nDependency Installed:\r\n  bind.x86_64 30:9.3.6-4.P1.el5_5.3\r\n\r\nComplete!\r\n<\/pre>\n<h2>Step 2: Configure BIND DNS Server<\/h2>\n<p>After installing the bind-chroot package, the next step is to configure the BIND DNS server. Before making any changes, it&#8217;s recommended to create a backup of the original configuration file. This can be done using the following command:<\/p>\n<pre>\r\n# cp \/etc\/named.conf \/etc\/named.bak\r\n<\/pre>\n<p>Open the configuration file using your preferred text editor:<\/p>\n<pre>\r\n# vim \/etc\/named.conf\r\n<\/pre>\n<p>In the &#8216;Options&#8217; 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:<\/p>\n<pre>\r\n\/\/ listen-on port 53 { 127.0.0.1; }; \r\n\/\/ listen-on-v6 port 53 { ::1; };\r\n<\/pre>\n<p>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:<\/p>\n<pre>\r\nallow-query { localhost; 192.168.54.0\/24; };\r\n<\/pre>\n<h2>Step 3: Create a Forward DNS Zone File for the Domain<\/h2>\n<p>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:<\/p>\n<pre>\r\n[root@server ~]# vim \/var\/named\/webhostinggeeks.local.db\r\n<\/pre>\n<h2>Step 4: Create a Reverse DNS Zone File for the Domain<\/h2>\n<p>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:<\/p>\n<pre>\r\n[root@server ~]# vim \/var\/named\/webhostinggeeks.local.rev\r\n<\/pre>\n<p>After creating the forward and reverse DNS zone files, assign the necessary file permissions:<\/p>\n<pre>\r\n# chown named:named \/var\/named\/webhostinggeeks.local.db\r\n# chown named:named \/var\/named\/webhostinggeeks.local.rev\r\n<\/pre>\n<h2>Step 5: Test the BIND DNS Server from a Client System<\/h2>\n<p>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:<\/p>\n<pre>\r\nnameserver 192.168.54.55\r\n<\/pre>\n<p>Finally, use the nslookup command to test the BIND DNS server:<\/p>\n<pre>\r\n# nslookup dns-primary.webhostinggeeks.local\r\n# nslookup mail.webhostinggeeks.local\r\n# nslookup www.webhostinggeeks.local\r\n# nslookup ftp.webhostinggeeks.local\r\n# nslookup 192.168.54.55\r\n<\/pre>\n<h2>Commands Mentioned<\/h2>\n<ul>\n<li><span class=\"fw-bold\">yum install bind-chroot<\/span> \u2013 This command is used to install the bind-chroot package on CentOS or RHEL.<\/li>\n<li><span class=\"fw-bold\">cp \/etc\/named.conf \/etc\/named.bak<\/span> \u2013 This command is used to create a backup of the original configuration file.<\/li>\n<li><span class=\"fw-bold\">vim \/etc\/named.conf<\/span> \u2013 This command isused to open the configuration file in the vim editor.<\/li>\n<li><span class=\"fw-bold\">vim \/var\/named\/webhostinggeeks.local.db<\/span> \u2013 This command is used to create and open the forward DNS zone file.<\/li>\n<li><span class=\"fw-bold\">vim \/var\/named\/webhostinggeeks.local.rev<\/span> \u2013 This command is used to create and open the reverse DNS zone file.<\/li>\n<li><span class=\"fw-bold\">chown named:named \/var\/named\/webhostinggeeks.local.db<\/span> \u2013 This command is used to change the ownership of the forward DNS zone file to the named user and group.<\/li>\n<li><span class=\"fw-bold\">chown named:named \/var\/named\/webhostinggeeks.local.rev<\/span> \u2013 This command is used to change the ownership of the reverse DNS zone file to the named user and group.<\/li>\n<li><span class=\"fw-bold\">nslookup dns-primary.webhostinggeeks.local<\/span> \u2013 This command is used to test the DNS resolution of the primary DNS server.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>Whether you&#8217;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.<\/p>\n<p>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.<\/p>\n<p>Note, that choosing the right web server is also an essential part of web hosting. Whether it&#8217;s <a href=\"https:\/\/webhostinggeeks.com\/blog\/apache-http-server-explained\/\">Apache<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/nginx-server-explained\/\">Nginx<\/a>, or <a href=\"https:\/\/webhostinggeeks.com\/blog\/litespeed-web-server-explained\/\">LiteSpeed<\/a>, each server has its own set of features and benefits.<\/p>\n<p>Hope this guide has been helpful in your journey to becoming a more proficient webmaster or website administrator.<\/p>\n<p>Keep exploring, keep learning, and keep pushing the boundaries of your knowledge.<\/p>\n<h2>FAQ<\/h2>\n<ol itemscope itemtype=\"https:\/\/schema.org\/FAQPage\">\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is BIND DNS?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">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.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the purpose of the bind-chroot package?<\/p\n\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">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.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is CentOS and RHEL?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">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.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the yum command used for?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">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.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Why is DNS important in web hosting?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">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.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the purpose of the forward and reverse DNS zone files?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">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.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the nslookup command used for?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">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.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Why is it important to test the BIND DNS server from a client system?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">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.<\/span>\n            <\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;<\/p>\n","protected":false},"author":6,"featured_media":349,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[996,1065],"tags":[1228,1244,1337,1536,1713],"class_list":["post-348","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-system-administration","tag-bind","tag-centos","tag-dns","tag-linux","tag-rhel"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=348"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/348\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/349"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}