ping can not recognize host but host command can


 
Thread Tools Search this Thread
Special Forums IP Networking ping can not recognize host but host command can
# 1  
Old 08-10-2011
ping can not recognize host but host command can

Hi,

I have a weird problem.
when ever I do ping command like for example
Code:
ping unix.com

I get the following message:
Code:
[root@localhost ~]# ping unix.com
ping: unknown host unix.com

but when I use host the computer is able to know the host.
Code:
[root@localhost ~]# host unix.com
unix.com has address 81.17.242.186
unix.com mail is handled by 10 aspmx2.googlemail.com.
unix.com mail is handled by 10 aspmx3.googlemail.com.
unix.com mail is handled by 10 aspmx4.googlemail.com.
unix.com mail is handled by 10 aspmx5.googlemail.com.
unix.com mail is handled by 1 aspmx.l.google.com.
unix.com mail is handled by 5 alt1.aspmx.l.google.com.
unix.com mail is handled by 5 alt2.aspmx.l.google.com.

what is the reason?
why the ping can not recognize the host but the host command can?
# 2  
Old 08-11-2011
further to the same problem, why does nslookup unix.com return 192.168.100.5 and ping unix.com tries 207.139.nnn.nnn?
# 3  
Old 08-11-2011
may be this is the problem -


from man page of ping -

argument of inet, IPv4 is used. For inet6, IPv6 is used.

By default, if the name of a host is provided,not the literal IP address, and a valid IPv6 address exists in the name service database, ping will use this address. Otherwise, if the name service database contains an IPv4 address, it will try the IPv4 address.

Specify the address family inet or inet6 to override the default behavior. If the argument specified is inet, ping will use the IPv4 address associated with the host name. If none exists, ping will state that the host is unknown and exit. It does not try to determine if an IPv6 address exists in the name service database.

If the specified argument is inet6, ping uses the IPv6 address that is associated with the host name. If none exists, ping states that the host is unknown and exits.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Ping to remote host failed

Actually. I was getting a ping to remote host failed for one of my etherchannel. When I checked it was in backup adapter and again I use to faileover and brought to primary channel. But it was again going to backup channel and giving me the alert ping to remotehost failed. When I checked the load... (3 Replies)
Discussion started by: Mohamed Thamim
3 Replies

2. Shell Programming and Scripting

Ping Response from the host name

Hi All, I have the requirement where am pinging the server and matching the IP address with the existing IP address. Below code is returning me the IP address and my requirement is i have to see that also whether it is pinging or not PING useipapd01 (172.22.32.87) 56(84) bytes of data. 64... (1 Reply)
Discussion started by: sharsour
1 Replies

3. Shell Programming and Scripting

Ping Host Until it is up and email

Hi I am trying to write a script which runs until the host is up. i got it figured out that it needs to be in loop till it return $? = 0. Not getting it through though. I am not sure about the 6th line !!! #!/bin/sh HOSTS="host.txt" ping(){ for myhost in "$HOSTS" do ping -c -1 "$myhost"... (8 Replies)
Discussion started by: Antergen
8 Replies

4. Solaris

able to ping all hosts but not able to traceroute any host

i am using solaris 10 and i am able to ping all the hosts but i am not able to traceroute any of them. how to fix this? (9 Replies)
Discussion started by: chidori
9 Replies

5. Solaris

unable to ping a host in another domain

Hello I have a server in it.siroe.com I added it.siroe.com in /etc/resolv.conf. I still can't ping the server. any service to restart here? any other file to edit? thx (4 Replies)
Discussion started by: melanie_pfefer
4 Replies

6. UNIX for Dummies Questions & Answers

PING to one host in one background process

Hi All, I'm doing one script on Juniper router where you have one FreeBSD Shell: Is pinging from time to time one ethernet port of othere router and in case of fail is blocking one port entering in CLI and doing some command: If I run this script all is working perfectly, but if I run in... (1 Reply)
Discussion started by: teigipo
1 Replies

7. Solaris

PING - Unknown host 127.0.0.1, Unknown host localhost - Solaris 10

Hello, I have a problem - I created a chrooted jail for one user. When I'm logged in as root, everything work fine, but when I'm logged in as a chrooted user - I have many problems: 1. When I execute the command ping, I get weird results: bash-3.00$ usr/sbin/ping localhost ... (4 Replies)
Discussion started by: Przemek
4 Replies

8. Shell Programming and Scripting

help to ping a host, is it alive or not ...

hello to everyone, i was wondering if you could help me with a script im working on, it's kind of simple but i dont have a lot experience on unix comands: well, here it is: you might apreciate the infinite while loop :D, it is supossed to be running on the server all day scaning it every 5... (12 Replies)
Discussion started by: sx3v1l_1n51de
12 Replies

9. IP Networking

QNX host cannot ping SCO host, vice versa

The problem I am facing now is that the QNX host could not ping the SCO host and vice versa. They are in the same domain, ie, 172.20.3.xx. As I am very new to Unix, I guess I must have missed out some important steps. Pls help... Thanx alot (2 Replies)
Discussion started by: gavon
2 Replies

10. UNIX for Dummies Questions & Answers

Unable to ping host

Hi, dear all, I am rather new to Unix and have this problem where I cant seem to ping from 1 host to another. The scenerio is as follows: - 1 QNX host->Eth->1 SCO host the SCO host is configured with it's IP the QNX host is configured with another IP both in the same domain, ie, 172.20.3.XX... (3 Replies)
Discussion started by: gavon
3 Replies
Login or Register to Ask a Question