Ubuntu Server 18.04: How to Set DNS Nameservers

0
Ubuntu Server 18.04 How to Set DNS Nameservers

Ubuntu Server 18.04 How to Set DNS Nameservers

In this article, we’ll walk you through the steps required to set DNS nameservers in Ubuntu Server 18.04. There are two main reasons why you would want to do this: redundancy and load balancing. We’ll go over both of these topics, as well as how to implement them in Ubuntu Server 18.04 by setting nameservers on your network interfaces.

Install Bind9

BIND9 is an open source software that implements the Domain Name System (DNS) protocols for the Internet. It is a popular choice for many small and medium-sized organizations and is also used by many large corporations, including Google, Facebook, and Amazon. Bind9 can be installed using aptitude or apt-get command. The commands below will install Bind9 on Ubuntu Server 18.04 LTS as well as configure it to start automatically at boot time with its associated service scripts.

First, add your user account to the bind group so you have appropriate permissions when editing files. Then, log in as root and enter these commands: sudo su –

apt update && apt upgrade && apt install bind9 -y

systemctl enable named && systemctl start named

The last two lines above are necessary if you want Bind9 to start up each time the system boots. You can check that everything went smoothly by checking logs in /var/log/syslog . Look for something like named: started. You can also verify this using ps aux grep named or pgrep to search for process running under named command.

Configure Bind9

In this guide, we will cover how to install and configure the Bind9 DNS server on Ubuntu Server 18.04. By the end of this guide, you will have a fully functioning DNS server that can resolve both forward and reverse queries. First, update your system’s package cache by running apt-get update from the terminal. Next, use apt-get to install bind9 with the following command: apt-get -y install bind9 ; After installation is complete, run /etc/init.d/bind9 start in order to start the service. To confirm that it is running, use ps aux grep named . The output should contain named at least once. If not, refer to our troubleshooting steps for assistance.

Next, create the appropriate directories for Bind to store its data. Type mkdir -p /var/named and hit enter. Create the log directory with mkdir -p /var/log/named . Create new owner and group ownerships with chown named:named /var/named; chown named:named /var/log/. Now create an appropriate configuration file by typing touch /etc/bind/.options then open it up in nano or your favorite text editor. Add three lines of text as follows: options { directory /var/named; pid-file /run/named.pid; }; Refer to Appendix A if you need help understanding what these lines mean.

Test Bind9

BIND9 is the default DNS server software on Ubuntu Server 18.04. This how-to guide will help you set up your own BIND9 nameserver on a Ubuntu Server 18.04 machine. You’ll need to be logged in as a user with sudo privileges in order to complete this tutorial. To do so, open a terminal and type sudo su and enter your password. Then continue below by typing sudo.

Next, we’re going to install BIND9 and configure it. Type the following commands into your terminal window (after exiting out of sudo): apt update && apt upgrade && apt install bind9 -y && service bind9 start . It’s recommended that you then add 127.0.0.1 for any future interface changes or edits, if necessary, to ensure security at all times (see here). If a message pops up asking whether you want to create an additional forward zone for which domain name, say no thanks and hit Enter . That’s it! Your new DNS server should now be active!

Leave a Reply

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