Monday, December 3, 2012

How to configure the DNS in Unix and Linux servers?

How to configure the DNS in Unix and Linux servers?


A) Steps:

First Create the file called /etc/resolv.conf - which includes the primary and secondary DNS server IP address for UNIX system, its your own DNS server.

# touch /etc/resolv.conf
# vi /etc/resolv.conf (Add the following lines to it)
domain test-lob.com 
nameserver ipaddress
nameserver ipaddress
Where, nameserver IP: It is IP of first DNS server and secondary DNS server of test-lob.com.


Search test-lob.com: Default domain name to search.

For example, if you type command nslookup www, it will search it as www.test-lob.com

For AIX Enable the name resolving using DNS as follows:
Edit the file /etc/netsvc.conf so that the “host =” will be pointing to local and dns as in the following
hosts=local,bind

For Solaris and Linux, Enable the name resolving using DNS as follows:
Edit the file /etc/nsswitch.conf so that the “host:” will be pointing to local and dns as in the following
hosts: files dns

B). VALIDATION REQUIREMENTS
Check with nslookup it should be able to resolve the host to IP and IP to host as in the following example
# nslookup
Default Server: change.test-lob.com
Address: 10.14.15.16
> lotus

Server: change.test-lob.com
Address: 10.14.15.16

Name: lotus.test-lob.com
Address: 10.120.12.6

Resolve from IP to host:
nslookup 10.120.12.6

Server: change.test-lob.com
Address: 10.14.15.16


Name: lotus.test-lob.com
Address: 10.120.12.6


C). ROLL BACK
AIX:
Remove the entries you have added in the /etc/netsvc.conf , so that the server will point to local host configuration file ( /etc/hosts ) only.

LINUX & SOLARIS:
Remove the entries you have added in the /etc/nsswitch.conf so that the server will point to local host configuration file ( /etc/hosts ) only.



If you happy with above topic, Kindly rate your reactions/comments below