Log in to your Debian 9 VPS with SSH as the root user, or as a user with sudo privileges:<\/p>\n
ssh root@IP_Address -p Port_Number<\/pre>\nRemember to replace “IP_Address” and “Port_Number” with your server’s respective IP address and SSH port.<\/p>\n
You can check whether you have the proper Debian 9 version installed on your server with the following command:<\/p>\n
# lsb_release -a<\/pre>\nYou should get this output (or something similar to this):<\/p>\n
Distributor ID: Debian\r\nDescription: Debian GNU\/Linux 9.7 (stretch)\r\nRelease: 9.7\r\nCodename: stretch<\/pre>\nThen, run the following command to make sure that all installed packages on the server are updated to the latest available version:<\/p>\n
# apt update && apt upgrade<\/pre>\n<\/span>Step 2: Install and Configure the Name Server<\/span><\/h2>\nIn this tutorial, we will install bind9<\/code> and dnsutils<\/code>.<\/p>\n# apt install bind9 dnsutils -y<\/pre>\nOnce the installation is complete, edit the \/etc\/bind\/named.conf.local<\/code> configuration file and add something like this: (make sure you change your_domain.net<\/span> and 12.34.56.78 to your actual domain name and IP address)<\/p>\n# nano \/etc\/bind\/named.conf.local<\/pre>\nzone \"your_domain.net<\/span>\" {\r\ntype master;\r\nfile \"\/etc\/bind\/zones\/your_domain.net<\/span>.db\";\r\n};<\/pre>\nThe next thing we’re going to do is to create a zone file for the your_domain.net<\/span> domain. Do it by entering the following command:<\/p>\n# mkdir -p \/etc\/bind\/zones && nano \/etc\/bind\/zones\/your_domain.net<\/span>.db<\/pre>\n; Zone file for your_domain.net<\/code> @ 14400 IN SOA ns1.your_domain.net<\/code>. root.your_domain.net<\/code>. ( 2012110501 ; serial, todays date+todays 28800 ; refresh, seconds 7200 ; retry, seconds 3600000 ; expire, seconds 86400 ) ; minimum, seconds your_domain.net<\/span>. 14400 IN NS ns1.your_domain.net<\/span>. your_domain.net<\/span>. 14400 IN NS ns2.your_domain.net<\/span>. ns1 14400 IN A 12.34.56.78 ns2 14400 IN A 12.34.56.78 mail 14400 IN CNAME your_domain.net<\/span>. www 14400 IN CNAME your_domain.net<\/span>. ftp 14400 IN CNAME your_domain.net<\/span>. your_domain.net<\/span>. 14400 IN A 12.34.56.78 your_domain.net<\/span>. 14400 IN MX 0 your_domain.net<\/span>.<\/pre>\nWith all of these configuration files in place, we should now have a working DNS server. The last thing you need to is to restart your DNS server and add it to your system startup services using:<\/p>\n
# systemctl restart bind9\r\n# systemctl enable bind9<\/pre>\nNow, you can go to your domain registrar again, change the existing authoritative name servers to ns1.your_domain.net<\/span><\/code> and ns2.your_domain.net<\/span><\/code>. You can verify the changes and the DNS propagation at https:\/\/www.whatsmydns.net\/#NS\/your_domain.net<\/span>.<\/p>\nIf you want to use the name servers for your anotherdomain.com<\/code>, you can simply copy \/etc\/bind\/zones\/your_domain.net<\/span>.db and make several changes.<\/p>\n# cp \/etc\/bind\/zones\/your_domain.net<\/span>.db \/etc\/bind\/zones\/anotherdomain.com.db<\/pre>\n# nano \/etc\/bind\/zones\/anotherdomain.com.db<\/pre>\n; Zone file for anotherdomain.com\r\n@ 14400 IN SOA ns1.your_domain.net<\/span><\/code>. root.your_domain.net<\/span><\/code>. ( 2012110501 ; serial, todays date+todays 28800 ; refresh, seconds 7200 ; retry, seconds 3600000 ; expire, seconds 86400 ) ; minimum, seconds anotherdomain.com. 14400 IN NS ns1.your_domain.net<\/span>. anotherdomain.com. 14400 IN NS ns2.your_domain.net<\/span>. mail 14400 IN CNAME anotherdomain.com. www 14400 IN CNAME anotherdomain.com. ftp 14400 IN CNAME anotherdomain.com. anotherdomain.com. 14400 IN A 12.34.56.78 anotherdomain.com. 14400 IN MX 0 anotherdomain.com.<\/pre>\nSave the changes and exit from nano.<\/p>\n
The DNS records for anotherdomain.com<\/code> have been added, now it is time to include the anotherdomain.com<\/code> in named.conf.local file.<\/p>\n# nano \/etc\/bind\/named.conf.local<\/pre>\nEdit your existing configuration and make it like the following.<\/p>\n
zone \"your_domain.net<\/span>\" {\r\ntype master;\r\nfile \"\/etc\/bind\/zones\/your_domain.net<\/span>.db\";\r\n};\r\n\r\nzone \"anotherdomain.com\" {\r\ntype master;\r\nfile \"\/etc\/bind\/zones\/anotherdomain.com.db\";\r\n\r\n};<\/pre>\nSave the changes and exit.<\/p>\n
Then, we need to restart BIND9 after every change we make, like adding a new domain or after editing the DNS records.<\/p>\n
# systemctl restart bind9<\/pre>\nCongratulations! At this point BIND9 has been successfully installed on your VPS, and you can use your name servers for all your domains.<\/p>\n
\n Of course, you don\u2019t have to know how to install and configure a DNS server using BIND9 on Debian 9 if you use our\u00a0Managed Debian 9 VPS Hosting<\/a> service. You can simply ask our support team to configure your DNS server on Debian 9 for you. They are available 24\/7, and will be able to help you with the installation of BIND9 on Debian 9.<\/p>\nPS<\/strong><\/span>. If you enjoy reading this blog post on how to configure your DNS server using BIND on Debian 9<\/strong>, feel free to share it on social networks using the shortcuts below, or simply leave a comment. Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"In the following tutorial, we’re going to go through the process of installing and configuring a simple DNS (BIND) server … <\/p>\n
Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":30493,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1700,13],"tags":[181,48,183,182,1152,18],"yoast_head":"\nHow to Install and Configure a Simple DNS (BIND) Server on Debian 9 - RoseHosting<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n