Operating System - HP-UX
1820698 Members
2618 Online
109627 Solutions
New Discussion юеВ

Re: /etc/hosts vs dns server

 
SOLVED
Go to solution
Donald O'Brien
Advisor

/etc/hosts vs dns server

How can I configure my HP-UX 11.00 system to prefer the /etc/hosts file entries before turning the dns servers?

I have some host names that will not be added to a dns server, but I need them to recognized by a system in its /etc/hosts file. Right now whenever I configure a system to use dns, it outright ignores the /etc/hosts file.

Donald O'Brien.
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor
Solution

Re: /etc/hosts vs dns server

Hi Donald:

In your '/etc/nsswitch.conf' file put this line:

hosts: files [NOTFOUND=continue] dns

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

domain xxx.com
nameserver 10.101.102.103

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

Regards!

...JRF...
Rajeev  Shukla
Honored Contributor

Re: /etc/hosts vs dns server

Hi Donald,
If you want your server to look at /etc/hosts before DNS just edit /etc/nsswitch.conf file (if not there create one) and add a line called:
hosts: files [NOTFOUND=continue] dns

That should work.

Rajeev
Donald O'Brien
Advisor

Re: /etc/hosts vs dns server

Thanks! This worked like a charm.

Donald O'Brien.