ping by hostname not working | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

ping by hostname not working

UNIX for Advanced & Expert Users


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-24-2011
linuxgeek linuxgeek is offline
Registered User
 
Join Date: Nov 2009
Last Activity: 10 May 2012, 10:18 PM EDT
Posts: 78
Thanks: 13
Thanked 0 Times in 0 Posts
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.


Code:
[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


Last edited by Scott; 11-24-2011 at 02:14 AM.. Reason: Removed formatting, change quote to code tags
Sponsored Links
    #2  
Old 11-24-2011
frappa frappa is offline
Registered User
 
Join Date: Mar 2008
Last Activity: 12 August 2013, 6:26 AM EDT
Location: Italy - EU
Posts: 174
Thanks: 5
Thanked 35 Times in 35 Posts
Hi,

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

see ya

fra

Last edited by frappa; 11-24-2011 at 02:39 AM.. Reason: typo correction
Sponsored Links
    #3  
Old 11-24-2011
linuxgeek linuxgeek is offline
Registered User
 
Join Date: Nov 2009
Last Activity: 10 May 2012, 10:18 PM EDT
Posts: 78
Thanks: 13
Thanked 0 Times in 0 Posts
here you go:

/etc/nsswitch.conf:

Quote:
#hosts: db files nisplus nis dns
hosts: files dns
bootparams: nisplus [NOTFOUND=return] files

ethers: files
netmasks: files
networks: files
protocols: files
rpc: files
services: files

netgroup: nisplus
publickey: nisplus
automount: files nisplus
aliases: files nisplus
/etc/resolv.conf:

Quote:
[root@puppetmaster ~]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script

search prod.nyxxx.com nyxxx.com
nameserver 10.11.49.206
nameserver 10.10.50.206
/etc/hosts:
Quote:
[root@puppetmaster ~]# cat /etc/hosts
# HEADER: This file was autogenerated at Wed Oct 05 18:38:36 -0400 2011
# HEADER: by puppet. While it can still be managed manually, it
# HEADER: is definitely not recommended.
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
#192.168.11.60 puppetmaster.nyfix.selab.local puppetmaster
192.168.10.181 puppetmaster.nyfix.selab.local puppetmaster
192.168.11.65 puppetclient.nyfix.selab.local puppetclient
if I place the hostname in /etc/hosts its pingable.
    #4  
Old 11-24-2011
frappa frappa is offline
Registered User
 
Join Date: Mar 2008
Last Activity: 12 August 2013, 6:26 AM EDT
Location: Italy - EU
Posts: 174
Thanks: 5
Thanked 35 Times in 35 Posts
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:

Code:
which nslookup
which ping

- then listing the shared libraries to check for problems:

Code:
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

Last edited by frappa; 11-24-2011 at 03:59 AM.. Reason: removed urls to google.com, only string values needed
The Following User Says Thank You to frappa For This Useful Post:
linuxgeek (11-25-2011)
Sponsored Links
    #5  
Old 11-25-2011
linuxgeek linuxgeek is offline
Registered User
 
Join Date: Nov 2009
Last Activity: 10 May 2012, 10:18 PM EDT
Posts: 78
Thanks: 13
Thanked 0 Times in 0 Posts
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
- I can dig the clients and get the proper replies
- I can nslookup and get the proper replies
Still, haven't figured it out yet

Btw, my OS is Redhat 5.4 and it is a vm machine.

Last edited by linuxgeek; 11-25-2011 at 04:01 AM..
Sponsored Links
    #6  
Old 11-25-2011
frappa frappa is offline
Registered User
 
Join Date: Mar 2008
Last Activity: 12 August 2013, 6:26 AM EDT
Location: Italy - EU
Posts: 174
Thanks: 5
Thanked 35 Times in 35 Posts
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
Sponsored Links
    #7  
Old 11-25-2011
linuxgeek linuxgeek is offline
Registered User
 
Join Date: Nov 2009
Last Activity: 10 May 2012, 10:18 PM EDT
Posts: 78
Thanks: 13
Thanked 0 Times in 0 Posts
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.

Code:
[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


Code:
[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


Last edited by pludi; 11-25-2011 at 12:16 PM..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Suse 10 SP3 won't ping hostname kopper UNIX for Dummies Questions & Answers 4 08-16-2010 06:08 PM
Ping by hostname lo-lp-kl AIX 5 11-20-2008 11:15 AM
Can't ping using hostname on Solaris 10 alpha123 Solaris 4 10-29-2008 02:05 AM
cannot ping by hostname tlee Solaris 1 03-12-2008 07:03 AM
UX 11iV2 - No ping by hostname netwalker HP-UX 7 08-26-2007 12:52 PM



All times are GMT -4. The time now is 02:58 AM.