4

I'm pinging from a Windows Box to a device that I rebooted.

PS C:\Users\administrador> ping 192.168.2.10

Pinging 192.168.2.10 with 32 bytes of data:
Control-C
PS C:\Users\administrador> ping -t 192.168.2.10

Pinging 192.168.2.10 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Reply from 192.168.2.120: Destination host unreachable.
Reply from 192.168.2.120: Destination host unreachable.
Reply from 192.168.2.120: Destination host unreachable.
Reply from 192.168.2.120: Destination host unreachable.
Reply from 192.168.2.120: Destination host unreachable.
Reply from 192.168.2.120: Destination host unreachable.
Reply from 192.168.2.120: Destination host unreachable.
Reply from 192.168.2.120: Destination host unreachable.
Reply from 192.168.2.120: Destination host unreachable.
Reply from 192.168.2.120: Destination host unreachable.

Ping statistics for 192.168.2.10:
    Packets: Sent = 17, Received = 10, Lost = 7 (41% loss),
Control-C

After this, the host started to answer the ping probes.

So, my questions are:

  1. What's the difference between those answers?
  2. Why the ping result is showing only 41% loss instead of 100%?
  3. Is there any relation between the "Destination host unreachable" answer and the fact that the machine is starting?
7

First we need to understand how packets are sent.

When a host or router tries to send an IPv4 packet* it first looks up the destination in it's routing table. Based on the routing table it determines the "next hop IP address" and interface. For a machine on a local subnet the "next hop IP address" will be the IP address of the destination, otherwise it will be the IP of a gateway.

What happens next depends on the interface type. Assuming it's an Ethernet or similar interface the network stack needs to determine what MAC address to send the packet to. To do that it looks up the "next hop IP address" in the ARP table for the interface. If it finds a valid entry then it fills in the MAC address and sends the packet out over the Ethernet interface.

If it doesn't find a valid ARP table entry then it will begin the ARP process to try and create one. In the meantime packets destined for that next-hop IP address will be queued up until the system knows what MAC address to send them too.

If the ARP process times out then on many platforms, any queued up packets will be rejected with a "destination host unreachable" ICMP message (some platforms just silently drop the packets).

Eventually entries in the ARP table time out and need to be refreshed.

On hosts/routers without a default gateway you can also get a "destination host unreachable" reply generated if there is no routing table entry, so the system doesn't even know what interface to ARP on.


So what happens when you power cycle a machine and ping it?

At first you likely already have a valid ARP table entry. Your machine puts the packets on the wire but they never get delivered because the network stack on the destination is down. You get "Request timed out" (with microsoft ping, linux ping doesn't display the lack of response at all).

Later the ARP cache entry times out. The hop before the box you power cycled (may be your client box or a router) tries to do a new ARP lookup but fails, so it bounces the packets with ICMP errors. Often you see multiple packets get queued up and bounced at the same time.

Finally the network stack on the target box comes back up. ARP succeeds and the packets are sent to the target which replies to them.

* With IPv6 the principles are similar but the details are different.

6

The Request timed out. is while the destination MAC address is still in the source/router's ARP cache. The Reply from 192.168.2.120: Destination host unreachable. is after the destination MAC address has timed out of the source/router's ARP cache, and the source/router no longer has, or can get, a MAC address for the destination. Eventually, the destination comes back up, and it responds to the ARP request of the source/router, and your ping is successful.

You will need to ask Microsoft about the ping statistics. That is its version of ping, and applications and end-device configurations are off-topic here. It seems to count any ICMP reply as a valid reply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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