In this article we are going to discuss the different methods in Ubuntu for the DNS server configuration.
How we can do the DNS server configuration in the Ubuntu
We will discuss the method to configure the DNS server by opening a terminal and running a few commands:
DNS Server Configuration through the Ubuntu terminal
We can also configure the DNS through the terminal. For this purpose, first open the terminal by pressing CTRL + ALT + T. Before the installation process we will update our repository:
Now we will install the DNS server by using the command bind9:
Next step is to install the utilities of the DNS by using the command of “dnsutils”:
Now to configure the DNS, we will first go to the address /etc/bind/named.conf.options and add the Google DNS for just understanding. We will add the following text by opening the address in the nano editor.
Replace the following text in the editor, 8.8.8.8 is Google’s DNS:
8.8.8.8;
};
Now quit after saving it and enable the new configuration by restarting the DNS using the systemctl command.
Check the status of bind9
As the bind9 is running now we will test the domain which we edit in the configuration file as:
The output is showing it is the domain of Google and it runs successfully.
Now we will do primary zone configuration but before configuration lets have an idea what is going on. We stored some files at some host and in this configuration the DNS gets its data from that specific file for its zone. Now for such primary master configuration we will run the editor and will confirm that the following three commands are there and not commented on.
include “/etc/bind/named/.conf.local”;
include “/etc/bind/named/.conf.default-zones”;
To verify this we will open the editor as:
As a result we will see:
All the three lines are present in the output. Now for example we have a domain “gamer.com” for which we are going to configure so we will edit the file named.conf.local by opening as:
Edit the following text in the editor as:
type master;
file “/etc/bind/db.gamer.com”;
};
We will copy the contents from the db.local to the db.gamer.com:
And at this step, we will open the newly created file gamer.com as:
Output should be like this:
After making changes we will restart the DNS.
For communication of our created domain “gamer.com” with some IP address we have to do a reverse zone file. For such purpose we will also configure the reverse zone file as:
Here we will add the following text:
type master;
file “/etc/bind/db.10”;
};
Where 192.168.18 is the first three octets of my network, here you will replace it with your own. Now we will copy and create the new file with db.10 as:
Now we will open this file which we have created and its output should be as shown below:
Output is as follows:
In this last part we will confirm the configurations first by executing all these commands and check whether they generate errors or not:
$ named-checkzone 192.168.0.0 /32 /etc/bind/db.10
$ named-checkconf /etc/bind/named.conf.local
$ named-checkconf /etc/bind/named.conf
Running all the above commands we have received no errors so our DNS has been configured successfully.
Conclusion
DNS is a technique through which we name the domains of different websites alphabetically and numerically so it is easy for servers to understand it. We have learned the configuration of the DNS (domain name system) in the article. We have learned that DNS is used to assign numerical based addresses to the alphabetical domains. We configured the google domain in the command line method and also tested it, also in the terminal method, we did forward and reverse file zone configuration by creating a domain of gamer.com. We hope this article will help you a lot and will resolve all the queries regarding the configuration of the DNS.