Operating System - HP-UX
1819791 Members
3218 Online
109607 Solutions
New Discussion юеВ

System pings an IP address but won't ping a host name

 
SOLVED
Go to solution
Mubarak Rebhan
Occasional Advisor

System pings an IP address but won't ping a host name

We have an UP UX 11.0 with patch level 48.

I have a poblem defining any new entry in the /etc/hosts file. Whenever I add a new entry there the system will not be able to ping it by host name although it can ping it by IP address.
More over there is an entry that I needed to remove from the /etc/hosts file and the system still remembers the host name and can ping it.
Any body have an idea what could cause this?
4 REPLIES 4
Rainer_1
Honored Contributor

Re: System pings an IP address but won't ping a host name

This sounds like you use DNS .
Check the file /etc/resolv.conf
If you have a DNS server defined in /etc/resolv.conf check the file
/etc/nsswitch.conf
For hosts it should have the line:
hosts : dns [NOTFOUND=continue UNAVAIL=return TRYAGAIN=continue] files
Dan Hetzel
Honored Contributor
Solution

Re: System pings an IP address but won't ping a host name

Hi,

type the following command:
# nslookup your_host_name

It will surely show that you're using DNS to resolve your hostnames.

then:
# nslookup
> policy

will show you in which sequence you are resoving hostnames (FILES - DNS or DNS - FILES)

You can easily change that sequence by editing the file /etc/nsswitch.conf as said here above.

man 4 resolver
man 4 switch
will tell you everything you need to know about those 2 files.

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Stefan Schulz
Honored Contributor

Re: System pings an IP address but won't ping a host name

This is a hostname resolution problem. Sounds like your /etc/hosts is not used for hostname resolution. Check your/etc/resolv.conf if you have an DNS Server. If so your /etc/nsswitch.conf should look like

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

This first use the DNS Server, if the hostname is not found there, then it will use your lokal /etc/hosts

Hope this helps.
No Mouse found. System halted. Press Mousebutton to continue.
Mubarak Rebhan
Occasional Advisor

Re: System pings an IP address but won't ping a host name

Thanks all...Your answers were very useful.
I updated the NIS hosts MAP using SAM>Networking and comm. > hosts > then actions> Build/Push NIS hosts map and that resolved the problem.

Regards.