Ping of short hostname doesn't work, ping of hostname. works, host works, nslookup works

Just installed CentOS 4.3 (kernel 2.6.9-34.EL) on a box and the local network name resolution doesn't work properly. It did work fine with CentOS 3.4 (kernel 2.4.21-32.EL).

Pinging a host on the local network doesn't work. Pinging the same host with a trailing dot works. Local name resolution with both host and nslookup work. Pinging a host on the Internet works. Here's the results of a few commands which show the problem:

[root@linux etc]# hostname
linux.local

[root@linux etc]# ping windows //DOESN'T WORK//
ping: unknown host windows

[root@linux etc]# ping windows. //THIS WORKS--NOTE TRAILING DOT//
PING windows (192.168.0.10) 56(84) bytes of data.
64 bytes from windows (192.168.0.10): icmp_seq=0 ttl=128 time=0.512 ms

[root@linux etc]# host windows //THIS WORKS WITHOUT THE TRAILING DOT//
windows has address 192.168.0.10

[root@linux etc]# nslookup windows //THIS WORKS WITHOUT THE TRAILING DOT//
Server:         192.168.0.1
Address:        192.168.0.1#53
Non-authoritative answer:
Name:   windows
Address: 192.168.0.10

Contents of some files:

/etc/host.conf:
order hosts,bind

/etc/hosts:
127.0.0.1               localhost
127.0.0.1               linux.local

/etc/sysconfig/network:
NETWORKING=yes
HOSTNAME=linux.local

Thanks in advance.
sldiamondAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kfullartonCommented:
Add this line to /etc/resolv.conf

search <your-domain-name>
0
kfullartonCommented:
In your /etc/hosts file,

>127.0.0.1               linux.local

This should be your IP address, not the loopback.
0
sldiamondAuthor Commented:
Thanks for the suggestion.

However, changing /etc/resolv.conf directly won't work, as the file seems to be generated dynamically on boot by /sbin/dhclient-script.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

sldiamondAuthor Commented:
kfullarton:

To your second comment, thanks. However the machine's IP address is assigned by a DHCP server elsewhere on the network, so I can't put it in the /etc/hosts file.
0
Gabriel OrozcoSolution ArchitectCommented:
do your /etc/resolv.conf have a line with
nameserver x.y.z.w

where such ip is your internal nameserver ip?

also take note of kfullarton post:
in /etc/hosts your 127.0.0.1 should be directed to localhost, or many things will not work correctly:
127.0.0.1        localhost.localdomain localhost
0
sldiamondAuthor Commented:
Redimido,

Thanks for your comment. /etc/resolv.conf already contains the nameserver directive:

; generated by /sbin/dhclient-script
nameserver 192.168.0.1

I edited /etc/hosts as you suggested, but the problem remains.

0
Gabriel OrozcoSolution ArchitectCommented:
one question. what's the centos ip address?
0
Gabriel OrozcoSolution ArchitectCommented:
second question. can you post your /etc/resolv.conf and your /etc/hosts?
thanks
0
sldiamondAuthor Commented:
IP address is 192.168.0.10

/etc/resolv.conf:
; generated by /sbin/dhclient-script
nameserver 192.168.0.1

/etc/hosts:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
0
Gabriel OrozcoSolution ArchitectCommented:
I see you need to add to /etc/resolv.conf: (as kfullarton said)
nameserver 192.168.0.1
search your.internal.domain.name (replace)

it should work
0
sldiamondAuthor Commented:
Thanks for the suggestion.

However, please note my posting on 04/17/2006 12:07PM PDT to kfullarton: "...changing /etc/resolv.conf directly won't work, as the file seems to be generated dynamically on boot by /sbin/dhclient-script."
0
Gabriel OrozcoSolution ArchitectCommented:
ho, sorry, I forgot to write about this

you can edit dhclient options to not rewrite your resolv.conf, or (better) you can edit your DHCP server to send also the domain part =)

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kfullartonCommented:
I agree that the better route would be to edit your DHCP server config and have it pass out the search list.
0
sldiamondAuthor Commented:
Thanks. However, the DHCP server is a firewall/router appliance and dhcpd.conf is automatically re-written by the firmware.

Please note that everything works fine on a CentOS 3.4 (kernel 2.4.21-32.EL) box which has the same configuration files. Does that suggest anything?
0
Gabriel OrozcoSolution ArchitectCommented:
I think you have the option to check your dhclient options so /etc/resolv.conf does not get changed.

for the CentOS 3.4 behavior, it would be good if you check it's config files for any difference
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.