Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In the network my IP is 192.168.1.101. I am trying to establish my another home pc whose IP is 192.168.1.102(connected using a router). Now when I ping when the 192.168.1.102 is turned off, I get Sent = 4, Received = 4, Lost = 0 (0% loss). but, that PC is turned off,

  • why I would get 0% loss. I also get this 0% loss when the 192.168.1.102 is turned on.
  • And by Destination host unreachable. is it safe to assume that after pinging any ip, if I get this, then that IP is disconnected from the network?
  • Is there are only 2 states that an IP can be in a network? reachable(switched on and can be pinged) and unreachable(turned off so can't be pinged)
  • Can ping be blocked by firewall? If yes, how to check if that IP is in my network?(I am trying to develop a client server software, & I am looking for a way to detect a valid IP, which will be authenticated from the server side.)

when 192.168.1.102 is turned off

C:\Users>ping 192.168.1.102

Pinging 192.168.1.102 with 32 bytes of data:
Reply from 192.168.1.101: Destination host unreachable.
Reply from 192.168.1.101: Destination host unreachable.
Reply from 192.168.1.101: Destination host unreachable.
Reply from 192.168.1.101: Destination host unreachable.

Ping statistics for 192.168.1.102:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

when 192.168.1.102 is turned on

C:\Users>ping 192.168.1.102

Pinging 192.168.1.102 with 32 bytes of data:
Reply from 192.168.1.102: bytes=32 time=172ms TTL=128
Reply from 192.168.1.102: bytes=32 time=1ms TTL=128
Reply from 192.168.1.102: bytes=32 time=1ms TTL=128
Reply from 192.168.1.102: bytes=32 time=29ms TTL=128

Ping statistics for 192.168.1.102:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 172ms, Average = 50ms
share|improve this question
add comment

migrated from stackoverflow.com Jul 31 '11 at 1:51

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 5 down vote accepted

Windows ping reports 0% loss in this situation, but Linux's ping reports 100% loss. It's really a semantic issue because in a "Destination host unreachable" situation the actual ping packet isn't sent (it's the ARP lookup that fails).

To answer your secondardy question: it is possible that a ping will fail even if the machine is on, because the firewall can block ICMP ping packets.

If you want suggestions on alernate solutions to your problem, please elaborate on what type of "authentication" you are trying to perform.

If you just want to know if an address is on the same local network ("subnet"), you may be interested in the route print command. Look at the Network Destination and Netmask columns to determine the address range of the current subnet.

share|improve this answer
    
+1 It's almost certainly an ARP lookup failure between the .101 host and the new .102 host when the .102 host is off, and it's a bug in the Windows ping command that it would report a local ARP failure as somehow counting as an ICMP echo reply being received. –  Spiff Jul 31 '11 at 7:47
add comment

Your router is reporting that it received 100%, not the host. The host was clearly "Destination host unreachable" because it is unreachable as the computer is off.

This is normal behavior, and exactly what I get when I ping an IP address I know is not in use, and has not previously been in use. In this case, the router does not know if the host is reachable.

There is one more reply that ping can return and that is "Request timed out", and the difference between this and "Destination host unreachable" is that at some point the IP in question made it into the router's ARP (Address Resolution Protocol) table when it was turned on prior. It knows it WAS reachable, and is reporting now that it can't.

Of course Ping can be blocked by a software firewall. The easiest way to check is to turn off the firewall temporarily.

share|improve this answer
    
Sorry for the incremental answer. I kept thinkig of more to say and how to clarify it so it was more understandable. –  KCotreau Jul 31 '11 at 2:06
    
If you list the OS you are working with, I can tell you how to allow ICMP (used for Ping) packets. –  KCotreau Jul 31 '11 at 2:09
    
His router probably has nothing to do with this. Both his existing .101 host and his new .102 host are almost certainly on the same subnet, so the router isn't actually involved. When he says, "Connected via router", he probably really means "Connected via the built-in Ethernet switch on the LAN side of the router". –  Spiff Jul 31 '11 at 7:45
    
You've missed my point. Switches don't ARP or get involved in ICMP. The device between the two hosts did not "report" anything at all. This is a host problem, and you've incorrectly identified it as a problem with the connectivity device. This misidentification of where the problem is happening would hurt Klox's understanding of the problem domain, not help it. –  Spiff Jul 31 '11 at 16:37
    
P.S. I've seen this kind of muddled thinking about networking be the cause of a lot of networking Questions on SU. I downvote Answers that are wrong or significantly misleading like this, in hopes of ending the spread of this kind of murkiness. Please don't take it personally. If anything I hope you'll take it as an encouragement to learn networking better so you can be more correct and thus more helpful in your Answers. –  Spiff Jul 31 '11 at 16:44
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.