Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
cancel
Showing results for 
Search instead for 
Did you mean: 

DNS instead of /etc/hosts

SOLVED
Go to solution

DNS instead of /etc/hosts

When I originally set up my box I never bothered configuring any DNS stuff. Since I usually only connect to a few specific machines, I added the hostnames and IPs into my /etc/hosts and I was good to go.

When I do ftp or telnet into a host other than those specified in /etc/hosts, I have to use the IP. This usually involves pinging the address from my PC just to get the IP. Very annoying. Where can I find information on correcting my problem and telling my box to look at some DNS to resolve hostnames. I've read the "named" man page, but I think I'm missing something. How do I tell "named" where to look?

BTW, I'm on HP-UX 11.00.

Thanks,
Blake
5 REPLIES

Re: DNS instead of /etc/hosts

Sorry. I accidentally posted this message to the "Databases" section. I reposted to the Sys Admin section. Please ignore this.
Mike Wilcox
Occasional Visitor
Solution

Re: DNS instead of /etc/hosts

There are 2 files in /etc that you will need to modify. /etc/nsswitch.conf and /etc/resolv.conf.

In the /etc/resolv.conf...

domain
search
nameserver
nameserver


In the /etc/nsswitch.conf, change the hosts entry to read...

hosts: files [NOTFOUND=CONTINUE] dns

You should be able to do DNS resolution of host names not in your host file now.

good luck.
Joseph C. Denman
Honored Contributor

Re: DNS instead of /etc/hosts

Hi Blake,

You just need to do a couple of things.

1. Create or modify /etc/resolv.conf to look as follows:
domain www.mydomain.com
nameserver xxx.xxx.xxx.xxx (primary DNS)
nameserver xxx.xxx.xxx.xxx (secondary DNS)

2. Create or modify /etc/nsswitch.conf to have an entry as follows:
hosts: files [NOTFOUND=continue] dns


That should do it.

...jcd...
If I had only read the instructions first??
Victor_5
Trusted Contributor

Re: DNS instead of /etc/hosts

1. /etc/rc.config.d/namesvrs
set NAMED=1

Client side
2. /etc/resolv.conf
add search list and nameserver entires

3. /etc/nsswitch.conf
...
hosts: dns files
...

Re: DNS instead of /etc/hosts

Thanks everybody! That did the trick.