Operating System - HP-UX
1834102 Members
2548 Online
110063 Solutions
New Discussion

converting from /etc/hosts to dns server

 
SOLVED
Go to solution
Mike Barron_3
Advisor

converting from /etc/hosts to dns server

OK, Our development team wants us to convert all of our UNix servers from /etc/hosts to use dns. Now, within the enviroment we have about 8 unix servers. We already have a dns server (NT) that they are using within the NT environment.

Is the only thing we have to is
1. Create nsswitch.con file where:
hosts: dns [NOTFOUND=return] files

2. create resolv.conf file where:
"dns Server name" "dns server ip address"

Is that it? seems too simple...

Any help would be much appreciated..
8 REPLIES 8
Uday_S_Ankolekar
Honored Contributor
Solution

Re: converting from /etc/hosts to dns server

Hello,
Yes you are on right track. You need to modify both nsswitch.conf and resolv.conf in /etc/directory .

Configure nswwitch.conf file to look dns first then local files for hosts table.
and in resolv.conf put domian name and search orders.
Yes.. Unix is never complicated.:)

-Goodluck
-USA..
Good Luck..
Sandip Ghosh
Honored Contributor

Re: converting from /etc/hosts to dns server

1. Yes, the file name will be nsswitch.conf

2. You have to first enter the DNS domain name for search. Then you have to give the IP address of the DNS Servers.

Sandip
Good Luck!!!
James R. Ferguson
Acclaimed Contributor

Re: converting from /etc/hosts to dns server

Hi Mike:

Place an entry liike this in your '/etc/nsswitch.conf' file:

hosts: files [NOTFOUND=continue] dns

Now, create an 'etc/resolv.conf' file like:

domain xxx.com
nameserver 10.101.101.100
nameserver 10.101.101.101

No reboot is necessary. Use 'nslookup' to verify.

Regards!

...JRF...

Shannon Petry
Honored Contributor

Re: converting from /etc/hosts to dns server

If the Unix systems are in the NT DNS database, then yes it is as simple as making a /etc/resolve.conf with the following:
domain mydomain
nameserver 1.1.1.1
the domain line is optional, and only used for translating myhost to myhost.mydomain.com

For the nsswitch.conf, I would recommend you do the following.
hosts: dns [ NOTFOUND=continue UNAVAIL=continue TRYAGAIN=continue] files

What you have will work, but lock the systems for name resolution when the NT system is down/unavailable/service crashes, etc... Your safety valve is to look at local files when that occurs. NOTFOUND=return will literally lock the system if the resource is not there, waiting for resolution of the name.

Also, it is pretty easy to configure both the resolv.conf and nsswitch.conf through SAM.


Regards,
Shannon
Microsoft. When do you want a virus today?
Jeff Schussele
Honored Contributor

Re: converting from /etc/hosts to dns server

Hi Mike,

Yep, it's basically that simple. But I would do it somewhat different. I'd set nsswitch.conf for
files [NOTFOUND=return] dns
then trim the /etc/hosts down to JUST critical servers - as few as you'd need to keep running IF the DNS server failed and few enough to manually admin if necessary. Which leads to my 2nd point - you should run at least 2 DNS servers. One primary & one secondary to take over if primary fails. Heck you do state that they'll be NT....need I say more?

Also in that resolv.conf file you want

nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
domain subnet.company.com
search subnet.company.com subnet2.comapny.com


NOTES: 1) You MUST use the term nameserver - NOT the host name. 2) The Nameservers are tried from the top down. 3) The domain statement & search nets are optional - the domain adds that info to shortname (hostname only) searches & the search will cycle through those domains as well if hostname is not found in the original domain.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Mike Barron_3
Advisor

Re: converting from /etc/hosts to dns server

Thanks everyone for the help. I had an idea, just didn't think it was that easy....

Everyone gets tens.....

Thanks again.
Mike Barron_3
Advisor

Re: converting from /etc/hosts to dns server

What about AIX, anyone know.....


Is it the same?

James R. Ferguson
Acclaimed Contributor

Re: converting from /etc/hosts to dns server

Hi Mike:

'/etc/resolv.conf' is the same. For 'nsswitch' you use '/etc/netsvc.conf', but cnsult the AIX man pages -- the specifications therein are different.

Regards!

...JRF...