The difference between ping and tracert

networkingping

I basically know the difference in my head but I'm having trouble formulating it on paper. If someone could tell me a little more detailed explanation about the two I'd really appreciate it.

So basically my question is can someone give me a more detailed explanation about the differences between the ping and tracert functions in cmd?

Best Answer

Sounds like you're talking about Windows, eh?

PING sends ICMP echo request datagrams to the destination host specified. The destination host will send back ICMP echo reply datagrams, if it is so configured. People typically think of using PING to judge the "reachability" of a host. You can vary the size of PING packets and watch the round-trip time to learn a little about the network bandwidth conditions (as well as, obviously, measuring latency) between the source and destination hosts.

A rookie mistake, BTW, is thinking that because you never receive a reply your echo request datagram isn't getting to the remote host. The absense of replies tells you that your echo request didn't reach the destination host OR the reply from the destination host didn't make it back to you. The absense of PING replies doesn't tell you anything conclusive.

The Microsoft TRACERT utility seeks to provide similiar functionality to the Unix "traceroute" utility. Microsoft's TRACERT sends out ICMP echo request datagrams with increasing "time to live" (TTL) values. The TTL determines how many hosts an IP datagram can be forwarded through. Each host that forwards the datagram decrements the TTL until it reaches zero, at which point the host that decremended the count to zero sends an ICMP time to live exceeded datagram to the host that sourced the datagram that has ceased to "live". By sending out datagrams with increasing TTL values and watching where the time to live exceeded datagrams come from one can produce a "map" of the "hops" that the outbound datagram moved through, along information about how long it took for the datagram to round-trip.

Incidently, the Unix "traceroute" uses UDP datagrams rather than ICMP to perform a similar function.