Simple networking issues

3

1

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

Quazi Irfan

Posted 2011-07-31T01:43:28.110

Reputation: 384

Answers

5

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.

Klox

Posted 2011-07-31T01:43:28.110

Reputation: 1 183

+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 – 2011-07-31T07:47:55.293

0

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.

KCotreau

Posted 2011-07-31T01:43:28.110

Reputation: 24 985

Sorry for the incremental answer. I kept thinkig of more to say and how to clarify it so it was more understandable. – KCotreau – 2011-07-31T02:06:58.147

If you list the OS you are working with, I can tell you how to allow ICMP (used for Ping) packets. – KCotreau – 2011-07-31T02:09:00.533

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 – 2011-07-31T07:45:14.797

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 – 2011-07-31T16:37:44.617

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 – 2011-07-31T16:44:35.203

@KCotreau let us continue this discussion in chat

– Spiff – 2011-07-31T16:44:49.320

@Spiff I still believe that device is the one that is reporting that it received the packets, but that the destination is unreachable. I suggest that you add a comprehensive answer so I can clearly understand because we are not on the same page. – KCotreau – 2011-07-31T17:11:00.197