Setup Master-Slave DNS Server Using “Bind” Tools in RHEL/CentOS 6.5

Domain Name Server (DNS) used for name resolving to any hosts. Master DNS servers (Primary Server) are the original zone data handlers and Slave DNS server (Secondary Server) are just a backup servers which is used to copy the same zone information’s from the master servers. Master Server will resolve the names for every hosts which we defined in the zone database and use UDP protocol, because UDP protocols never use the acknowledgement process while tcp uses acknowledgement. DNS servers also use UDP protocols to resolve the query request at the earliest.

Setup Master Slave DNS in RHEL/CentOS 6.5

How DNS Works?

Understanding DNS might be little confusing for newbies. Here is a brief explanation on how the DNS work’s.

Let’s say, if we need to access any website what we will do? Just type www.google.com in browser and hit enter. Hmm that’s all we know, but the fact is, how pain DNS go through it, while querying for us. While we type www.google.com the system will look for www.google.com. Whenever we type some domain name, there is a . (dot) at the end of the www.google.com that say to search the root server of namespace.

Globally there are 13 root servers available to resolve the query. At first, while we hit enter as www.google.com our browser will pass a request to our local resolver, which has entry about our master and slave DNS server info. If they don’t have info about such requested query they will pass the request to the Top Level domain (TLD), if TLD say I don’t know the request, may be the authoritative server know your request, it will forward to authoritative servers, here only www.google.com was defined as address 72.36.15.56.

In mean time authoritative server will give the answer to TLD and TLD will pass to root server and root will provide the info to browser, hence the browser will cache the DNS request for future use. Thus these long process will just resolve with in milliseconds. If they don’t know the request they will reply as NXDOMAIN. That means, there is no record any-were found in the Zone database. Hope this makes you to understand how the DNS works.

Save and quit the file using wq!. After editing the reverse look-up, it looks like below, Use TAB to get a decent format in zone file.

Configure Reverse Lookup Zone

Check the group ownership of forward look-up & reverse look-up files, before checking for any errors in configuration.

$ sudo ls -l /var/named/

Here we can see both the files are in root users ownership, because files which we makes a copy from sample files are available under /var/named/. Change the group to named on both files using following commands.

By default iptables was running and our DNS server is restricted to localhost, if client wants to resolve name from our DNS Server, then we have to allow the inbound request, for that we need to add iptables inbound rule for the port 53.

That’s it!. Now time to configure our client machines and check for the hostname.

Configure Client Machine

In client side we need to assign the Primary (192.168.0.200) and Secondary DNS (192.168.0.201) entry in network settings to get assign a hostname. To do, run the setup command to define all these entries as shown in the picture.

Finally, setup completed, here we have configured both Primary (Master) and Slave (Seconday) DNS server successfully, hope everyone have setup-ed without any issue, feel free to drop a comment if you face any issue while setup.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

When your machine(client) is connected to the Internet through an ISP, it initiates a query to find facebook.com and sends the query to the DNS server of the ISP.

Then, the DNS Server of the ISP first checks it’s own cache to determine if it already has a result for your machine’s query.

In the event that the result is negative(meaning nothing found), it generates another query, sends it to a hierarchy above it. Your machine’s query will keep moving up the up until it reaches the root DNS servers, and until when facebook.com is found.

After the ISP DNS Server finding out the authoritative name servers, it contacts the authoritative name servers to find out the IP address for http://www.facebook.com. i.e. the IP address of host www in the domain facebook.com.

facebook.com then responds to the ISP DNS Server by answering the query and providing the IP address of the web server i.e. www

The ISP DNS Server stores the answer in it’s cache for any future use and provides the result to your machine(client) by sending the IP address of the www server plus so many other details.

Second question:

All the magic happens through your ISP, when your are connected to the Internet, the ISP must gather information about your network setup including the DNS server setup. Then other networks can find your DNS server through your ISP servers(network).

We’ve tried and kept the information as simple as it, but I am afraid that you still finding it tough to understand, no problem here is the screencast that tells how exactly dns works, just go through it: https://howdns.works/