ping by hostname not working

anyone ever seen this problem:

I can ping the server by IP address but I can't by hostname.

nslookup is working and dns query is ok.

[root@puppetmaster network-scripts]# nslookup mwxnsb24
Server:          10.11.49.206
Address:        10.11.49.206#53
 
Name:   mwxnsb24
Address:  10.10.58.175
    
[root@puppetmaster network-scripts]# ping 10.10.58.175
PING  10.10.58.175 (10.10.58.175) 56(84) bytes of data.
64 bytes from 10.10.58.175:  icmp_seq=1 ttl=57 time=3.52 ms
64 bytes from 10.10.58.175: icmp_seq=2 ttl=57  time=2.88 ms
  
---  10.10.58.175 ping statistics ---
2 packets transmitted, 2 received, 0% packet  loss, time 999ms
rtt min/avg/max/mdev = 2.886/3.204/3.522/0.318  ms

[root@puppetmaster ~]# ping mwxnsb24
ping:  unknown host mwxnsb24

Hi,

may you please post the contents of /etc/nsswitch.conf, /etc/resolv.conf and /etc/hosts?

see ya

fra

here you go:

/etc/nsswitch.conf:

/etc/resolv.conf:

/etc/hosts:

if I place the hostname in /etc/hosts its pingable.

Hi,

config files seem ok.
Googling around it seems somebody also experienced similar issues; not clear if and how they cleared the problem though..

First thing you could try to exclude problems with the internal nameservers you are using.
If you can, try reproduce the problem by ping/nslookup to an external site (i.e.: www. google.com).
If the above can be done, try also to use some external dns server (i.e. opendns) and repeat the test against an external host (i.e. www. google.com again).

If you can execute the above tests and if the results of the above tests replay the problem already posted, we can exclude a problem with internal dns servers.

Next thing I could suggest is verifying the shared libraries used by nslookup and by ping:
this can be done by:

  • looking for the full paths to nslookup and ping:
which nslookup
which ping
  • then listing the shared libraries to check for problems:
ldd -v /path/to/nslookup
ldd -v /path/to/ping

and verifying that the required libraries are actually available (in particular, the libdns* and libresolv* ones).

I may also suggest the following forum:
Weird ping issue on redhat box - Page 2 - [H]ard|Forum
the user ScYcS experienced similar problem, you could contact her/him directly to kow if and how he cleared the issue.

see ya
fra

1 Like

here's what i have done so far:

- Reverse the order "files dns" in /etc/nsswitch.conf and /etc/host.conf to have proper search as well

- Verified shared libraries of ping and nslookup using ldd -v /path/to/ping and verified that the required libraries are actually available (in particular, the libdns* and libresolv* )

- Tried to switch off network_ipv6 in /etc/sysconfig/network

- Interchange IP address of eth0 and eth1

- Even turn off the iptables firewall service to make sure there is no something blocking from the firewall

[LEFT]- I can dig the clients and get the proper replies

  • I can nslookup and get the proper replies[/LEFT]

[LEFT]Still, haven't figured it out yet

Btw, my OS is Redhat 5.4 and it is a vm machine.
[/LEFT]

Hi,

just for sake of completeness: did you experience this issue after an update/installazion of obsolete/new software, just after installation or all of a sudden?

see ya
fra

there is no new updates/installation of software or packages. The server is in lab environment and what is newly configured is NAT to connect it in production network. now, it is connected to prod by pinging the IP address of servers but can't ping by hostname. already exported the dns servers from prod network to the server but still encountered the same.

[root@puppetmaster ~]# nslookup mwxnsb24
Server:         10.11.49.206
Address:        10.11.49.206#53

Name:   mwxnsb24.nyxxx.com
Address: 10.10.58.175

[root@puppetmaster ~]# ping mwxnsb24
[root@puppetmaster ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Hi,

would it be possible to see if the problem is in the network between the problematic server, the dns servers and the target server?
May you use tcpdump (or wireshark, or other network traffic sniffers you're comfortable with) to look at what happens between the systems when you do a dns query via nslookup and when you try to ping the target hostname?

see ya
fra

unplug the ethernet which is connected to the Servr and plug into another PC ethernet port and try ping from there