DNS stands for Domain Name System (or Service or Server). It translates domain names into IP addresses. Generally, alphabetic domains are easier to remember, however, the Internet Service is based on IP addresses. So, every time we use domain name it gets translated to IP address.
For example, www.acadgild.com might translate to 126.96.36.199 .
Before moving on to how to configure DNS, we should be aware of the following:
- What is DNS?
- How it works?
So, what is DNS and how does it work?
DNS (Domain Name System) is a system which resolve Name into their associated IP address and vice versa. DNS is the part of Application Layer in TCP/IP reference model.
When translating Google.in to their associated IP addresses, we get the result as 188.8.131.52. When you type google.in into your web browser’s address bar, your computer contacts your current DNS server and asks what IP address is associated with it.
DNS is implemented using two software components:
(a) DNS server
(b) DNS client (or resolver).
Both the components are run as background service applications.
Now, let’s try to understand what is a Domain.
Brief Introduction about Domains:
A Domain provides hierarchy property to any name. Some of the top level Domains are as follows:
- .com (for commercial use)
- .net (for network solution)
- .edu (for educational use)
- .org (for non-profit organization)
- .mil ( for military only)
- .gov ( for government use)
- .int ( International use )
There are three types of zones (Database file). They are:
1) Forward Master Zone – Transfers name into IP.
2) Reverse Master Zone – Translates IP into name.
3) Slave Zone – Creates sub-domains.
Through DNS, you can create fully qualified Domain, Partially Qualified Domain Name or both.
https://google.com is a Fully Qualified Domain Name (FQDN)
https://drive.google.com is Partially Qualified Domain Name (PQDN)
Note: DNS Server is also known as BIND (Berkley Internet Naming Daemon).
DNS Configuration in Centos 6.7 Linux:
As with any new server, it’s always important to ensure that your system is up to date. You can verify this by checking for updates using ‘yum’ as follows:
The all DNS configuration need root access, so use root instead of normal user! Appears abrupt
yum update –y
Steps to Configure DNS in Centos Linux:
Step 1: To Begin with, you need to install the BIND and BIND Utilities packages using the below command.
yum install bind*
Step 2: Modify the active Ethernet properties as shown below.
Step 3: Configure /etc/sysconfig/network file to add a hostname.
Step 4: Now, open BIND (named) configuration file.
Next, find the highlighted properties and modify it accordingly to your Linux Server networking shown in the below images.
Note: You need to scroll down further to add more properties.
Finally, save and exit the named.conf using esc + wq!
Step 5: Create the Forward and Reverse Zone files as mentioned in named.conf.
Configuring Forward Zone:
- a) Create a Forward Zone file under /var/named in the name of forward.acadgild.net. There are samples under the /var/named/ directory, just make a copy of that file and modify it as per your requirement.
cp /var/named/named.localhost /var/named/forward.acadgild.net
- b) Modify the file forward.acadgild.net accordingly, as shown in the below screenshot.
Configuring Reverse Zone:
Create a file for Reverse Zone under /var/named or directly copy the Forward Zone into /var/named/reverse.acadgild.net
cp /var/named/forward.acadgild.net /var/named/reverse.acadgild.net
Now, add the properties into reverse.acadgild.net as shown in the below screenshot.
Now, the Forward and Reverse zones are configured.
Step 6: Change the group to named using below command.
As it is very important file to network it has to be isolated inside named directory.
chgrp named /var/named/forward.acadgild.net
chgrp named /var/named/reverse.acadgild.net
Step 7: Change ownership of these zone files.
chown named:named /var/named/forward.acadgild.net
chown named:named /var/named/reverse.acadgild.net
Step 8: We need to check for errors in the conf file and Zone file.
named-checkzone acadgild.net /var/named/forward.acadgild.net
o/p => OK
named-checkzone 1.168.192.in-addr.arpa /var/named/reverse.acadgild.net
Step 9: Now, we can start named services.
service named start
Once the named service has started successfully, we need to ensure that it is enabled as a startup service, by running the following command.
chkconfig named on
Step 10: Make sure to add the iptables rules or (disable it [optional] )
iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 53 -j ACCEPT iptables -A INPUT -p udp -m state --state NEW -m udp --dport 53 -j ACCEPT iptables -A INPUT -j DROP
You need to save the iptable and restart the iptables service using the below commands.
service iptables save
service iptables restart
Step 11: Check the DNS Server and the available host using dig and nslookup- command.
If you receive a response which includes an answer and authority section, then your Nameserver has been configured correctly.
The Master DNS has been configured Now.
In case of any queries related to this post, feel free to comment below or write to us at email@example.com
Keep visiting our website Acadgild for more updates on Big Data and other technologies. Click here to learn Big Data Hadoop Development.