Operating System - HP-UX
1753792 Members
4927 Online
108799 Solutions
New Discussion юеВ

/etc/hosts didn't resolve hostname

 
SOLVED
Go to solution
apple
Super Advisor

/etc/hosts didn't resolve hostname

dear hpux guru,
would like to seek your advice.
i have add entry inside /etc/hosts, but when i ping the hostname it says unknown host. i check the permission of /etc/hosts, all are same with the working server. the only different is this non-working server is hp integrity virtual machine. do we miss anything during the configuration that could cause the /etc/hosts didn't resolve the hostname.
hope to hear from you. thank you
10 REPLIES 10
apple
Super Advisor

Re: /etc/hosts didn't resolve hostname

additional update:
our other ivm is working. only this ivm is not working. what cause this? hope to hear from you.
rajv
Advisor

Re: /etc/hosts didn't resolve hostname

Hi,

check the dns configuration.

you need to add a route to the other network domain.

check out route add this can also be done through sam on hp-ux

use netstat -rn on a machine on the network and add the route entries to the machine you have.


Thanx
-VRS-
rajv
Advisor

Re: /etc/hosts didn't resolve hostname


other wise check with your network team to give the permission to access.

Thanx
-VRS-
Steven Schweda
Honored Contributor

Re: /etc/hosts didn't resolve hostname

HP-UX version?

> i have add entry inside /etc/hosts [...]

I can't see it. Nor can I see what you did
as your "ping" command.

> [...] do we miss anything during the
> configuration [...]

How could anyone know what you did (or
missed)? My psychic powers are too weak.

What's in /etc/nsswitch.conf? (I can't see
that, either.) "man nsswitch.conf". It's
possible (although unlikely) that you're not
looking at /etc/hosts.

Strictly speaking, /etc/hosts does not
resolve host names. The OS resolves host
names, and it does so according to the
specifications in /etc/nsswitch.conf, which
may or may not tell it to look at /etc/hosts,
NIS, DNS, LDAP, and so on. Also what to do
if a name is not found anywhere in the
search.
Bill Hassell
Honored Contributor

Re: /etc/hosts didn't resolve hostname

Use the nsquery command first:

nsquery hosts

That will show you exactly how the OS will lookup a hostname. If you have one or more DNS servers in /etc/resolv.conf, then the default is to completely ignore /etc/hosts. Read the man page on nsswitch.conf and then use the recommended line for hostname resolution:

hosts: files [NOTFOUND=continue UNAVAIL=continue] dns

This is recommended because it is much more efficient and timely changes can be made without bothering the DNS support team.


Bill Hassell, sysadmin
ManojK_1
Valued Contributor

Re: /etc/hosts didn't resolve hostname

Hi Almond.

could you please check /etc/nsswitch.conf file and send the output.

If you are not using DNS or LDAP please overwrite /etc/nsswitch.files to /etc/nsswitch.conf as given below.

#cp /etc/nsswitch.files /etc/nsswitch.conf

Manoj K
Thanks and Regards,
Manoj K
apple
Super Advisor

Re: /etc/hosts didn't resolve hostname

dear hpux gurus,
we are not using dns, we are resolving from /etc/hosts.

from our /etc/nsswitch.conf

#
# @(#)B11.23_LR
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# does not use any name services.
#
passwd: files
group: files
hosts: files
ipnodes: files
services: files
networks: files
protocols: files
rpc: files
publickey: files
netgroup: files
automount: files
aliases: files

hope to hear from you. thank you
apple
Super Advisor

Re: /etc/hosts didn't resolve hostname

# nsquery hosts flamingo

Using "files" for the hosts policy.

Searching /etc/hosts for flamingo
flamingo was NOTFOUND

Switch configuration: Allows fallback

All name services have been searched

but inside /etc/hosts, the hostname flamingo and the ip is there. ping the ip is working, but ping the hostname is not working. there is no firewall in between either. hope to hear from you. thank you
Victor Fridyev
Honored Contributor
Solution

Re: /etc/hosts didn't resolve hostname

Hi,

It looks like your /etc/hosts is a bit corrupted.
Can you delete the record with flamingo and verify that all entries in the /etc/hosts are resolved with nslookup, e.g.
nslookup localhost
nslookup anotherbird , whatever
Check this for records before and afer the flamingo record.
If everything is OK, add flamingo record and
run
nslookup flamingo


HTH
Entities are not to be multiplied beyond necessity - RTFM