Ping (networking utility)
Ping is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network. It measures the round-trip time for messages sent from the originating host to a destination computer that are echoed back to the source.
Ping operates by sending Internet Control Message Protocol (ICMP) Echo Request packets to the target host and waiting for an ICMP Echo Reply. The program reports errors, packet loss, and a statistical summary of the results, typically including the minimum, maximum, the mean round-trip times, and standard deviation of the mean.
Generic composition of an ICMP 32-byte packet:
Ping operates by sending Internet Control Message Protocol (ICMP) Echo Request packets to the target host and waiting for an ICMP Echo Reply. The program reports errors, packet loss, and a statistical summary of the results, typically including the minimum, maximum, the mean round-trip times, and standard deviation of the mean.
ICMP packet
Bits 0–7 | Bits 8–15 | Bits 16–23 | Bits 24–31 | |
---|---|---|---|---|
IP Header (20 bytes) | Version/IHL | Type of service | Length | |
Identification | flags and offset | |||
Time To Live (TTL) | Protocol | Checksum | ||
Source IP address | ||||
Destination IP address | ||||
ICMP Header (8 bytes) | Type of message | Code | Checksum | |
Header Data | ||||
ICMP Payload (optional) | Payload Data |
- IP Header (in blue): protocol set to 1 (ICMP) and Type of Service set to 0.
- ICMP Header (in red):
- Type of ICMP message (8 bits)
- Code (8 bits)
- Checksum (16 bits), calculated with the ICMP part of the packet (the IP header is not used). It is the 16-bit one's complement of the one's complement sum of the ICMP message starting with the Type field[8]
- Header Data (32 bits) field, which in this case (ICMP echo request and replies), will be composed of identifier (16 bits) and sequence number (16 bits).
ICMP Payload: payload for the different kind of answers; can be an arbitrary length, left to implementation detail.
评论
发表评论