Why does 'ping' returns 'request timed out' for some hosts?

12

1

For some hosts, ping www.example.com it resolves their IP but why does it fails with request time out? I have also tried to increase the ping response time but still the same result.

user10232

Posted 2011-02-03T11:11:53.493

Reputation: 235

No host is required to respond to ping requests. – R. Martinho Fernandes – 2011-02-03T11:14:41.767

Answers

11

A ping is an ICMP packet. For comparison, web traffic or HTTP, is generally a TCP packet on port 80. A given server may be providing responses for the purpose of web traffic, but block ICMP (or be behind a firewall that blocks ICMP) and therefore you can:

  • Resolve the URL to its IP address
  • Connect and view the web content

But you cannot ping the IP address. The response "request timed out" is because your client sends the initial packet, waits for a reply (which will never come), and gives up at a preset timeout.

JYelton

Posted 2011-02-03T11:11:53.493

Reputation: 2 848

6

Because it fails to connect to the host. Just because a DNS server knows the IP a host should have, does not mean that the host in question is running and accepting connections.

ho1

Posted 2011-02-03T11:11:53.493

Reputation: 313

Why would it not fail through browser? – None – 2011-02-03T11:14:22.760

2@cpx: a ping request is not an HTTP request. The host may be responding to the latter but ignoring the former. – R. Martinho Fernandes – 2011-02-03T11:15:17.413

2It's accepting TCP connections on port 80, but not ICMP connections. Nothing says a computer has to accept or respond to both. – Dan Grossman – 2011-02-03T11:15:42.150

2ICMP does not establish connections. Why does this answer gets voted up higher than Pablo's for example? ICMP blindly dispatches a frame to the destination host and waits for a few seconds if something comes back. – sinni800 – 2011-05-16T12:07:44.010

4

Maybe the host is actually down, or may be the case that some sites, block ICMP traffic (protocol PING command relies on).

Pablo Santa Cruz

Posted 2011-02-03T11:11:53.493

Reputation: 1 625

1

Well, ping fails to www.microsoft.com too, for example. It is because those server computers use a restrictive firewall blocking the ICMP packets from unknown hosts.

Also ping does not "CONNECT" to a host, it just dispatches a single packet to them. TCP does connection handshakes and tries very hard to keep the connection. Ping just dispatches a ICMP packet which is not guaranteed to reach its destination. Just like UDP does, for data.

If it does not each its destination or the destination throws the packet away (firewall?), you don't get an answer.

This is completely independent from http traffic which uses TCP.

sinni800

Posted 2011-02-03T11:11:53.493

Reputation: 3 048