Monday 13 May 2013

How to configure DNS Slave Server in Linux

A DNS server, or name server, is used to resolve an IP address to a hostname or vice versa.
You can set up four different types of DNS servers:
  • A master DNS server for your domain(s), which stores authoritative records for your domain.
  • A slave DNS server, which relies on a master DNS server for data.
  • A caching-only DNS server, which stores recent requests like a proxy server. It otherwise refers to other DNS servers.
  • A forwarding-only DNS server, which refers all requests to other DNS servers.
In our pervious article we have configured Master dns server. In this tutorial we will extended pervious article and configure salve dns server. This article is the second part of How to configure dns server step by step guide. We suggest you to review pervious article before starting it.

Configure dns slave server

For this example we are using three systems one linux server one linux clients and one window clients.

We have configured master DNS server with ip address of 192.168.0.254 and hostname server.example.com on linux server. Now we will configure slave DNS server on linux clients.

To configure slave DNS server go on client1 system.

First test connectivity from DNS server by ping commands and check necessary rpm. bind and caching-nameserver rpm is required to configure DNS. check them for install if not found install them.



set hostname to client1 and ip address to 192.168.0.1 And create a new named.conf file

named.conf

We are using bind's chroot features so all our necessary files will be located in chroot directory. Set directory location to /var/named. As we are configuring slave server so we need not to define the location of zone database files. Zone database file can be created and modified only on master server.

A slave server only copied it's from master server.

Do editing exactly as shown here in image in named.conf

named.conf

save this file with :wq and exit

If you cannot create this file manually then download this pre configured file and copy to /var/named/chroot/etc/named.conf

To download do right click here and choose save link As.. named.conf 

Now restart the named service. It should be start without any error.

service named restart

Congratulation you have configured both Master and client DNS server. Now we will configure dns client and test it with DNS server.

Configure Window DNS Client

Now go on windows xp system and test connectivity from DNS server. And set DNS ip address in LAN card properties.



ip address on window system

Now go on commands prompt and ping from other client by name to test DNS.

ping from dns server

Alternately You can also verify DNS server by nslookup command

nslookup

Test also by pinging server from name

ping server

Configure Linux DNS clients

RHCE Exam question
Dig Server.example.com, Resolve to successfully through DNS Where DNS server is 192.168.0.254.

RHCE Exam question2
Your System is configured in 192.168.0.0/24 Network and your nameserver is 192.168.0.254. Make successfully resolve to server.example.com. 

On command line interface you don't have any options to set DNS ip in network configuration window. IP of DNS server can be set from /etc/resolv.conf file. Each nameserver line represents a DNS server, and the search line specifies domain names to try if only the first part of a hostname is used. For example, if just the name client1 is used as a hostname, client1. example.com will also be tried if the /etc/resolv.conf file is configured as shown in image below on the system.

To set DNS ip open /etc/resolv.conf file


vi resolv.conf

set nameserver ip to 192.168.0.254 and search option to example.com

resolv.conf

After saving /etc/resolv.conf file restart the network service



dig server.example.com to test DNS server

dig server.example.com

now verify by pinging to other client from name

No comments:

Post a Comment