Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Ping (networking utility)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Message format== ===ICMP packet transported with IPv4=== An ICMP packet transported with IPv4 looks like this. {{APHD|start|title=IPv4 datagram}} {{APHD|0|bits1=4|field1=Version|value1=4|bits2=4|field2=IHL|value2=5|bits3=6|field3=DSCP|value3=0|bits4=2|field4=ECN|value4=0|bits5=16|field5=Total length}} {{APHD|4|bits1=16|bits2=3|bits3=13|field1=Identification|field2=Flags|field3=Fragment offset}} {{APHD|8|bits1=8|field1=Time to live|bits2=8|field2=Protocol|value2=1|hint2=Set to 1 to indicate ICMP.|bits3=16|field3=Header checksum}} {{APHD|12|bits1=32|field1=Source address}} {{APHD|16|bits1=32|field1=Destination address}} {{APHD|end}} {{APHD|start|header=no|title=ICMP ''Echo Request'' packet}} {{APHD|20|bits1=8|field1=Type|value1=8|background1=mistyrose|bits2=8|field2=Code|value2=0|background2=mistyrose|bits3=16|field3=Checksum|background3=mistyrose}} {{APHD|24|bits1=16|field1=Identifier|background1=mistyrose|bits2=16|field2=Sequence number|background2=mistyrose}} {{APHD|28|bits1=0|field1=(Payload)|background1=linen}} {{APHD|end}} ;{{APHD|def|name=Type|length=8 bits|text=Set to 8 to indicate 'Echo Request'.{{Ref RFC|792|rp14}}}} ;{{APHD|def|name=Checksum|length=16 bits|text=Checksum is the 16-bit [[ones' complement]] of the ones' complement sum of the ICMP packet, starting with the ''Type'' field,<ref name="networksorcery">{{cite web | title=RFC Sourcebook's page on ICMP | url=http://www.networksorcery.com/enp/protocol/icmp.htm#ICMP%20Header%20Checksum | access-date=20 December 2010 | archive-date=6 July 2018 | archive-url=https://web.archive.org/web/20180706090020/http://networksorcery.com/enp/protocol/icmp.htm#ICMP%20Header%20Checksum }}</ref> including the ''Payload''. The [[IP header]] is not included.}} ;{{APHD|def|name=Identifier|length=16 bits|text=Can be used by the client to match the reply with the request that caused the reply.}} ;{{APHD|def|name=Sequence number|length=16 bits|text=Can be used by the client to match the reply with the request that caused the reply.}} ;{{APHD|def|name=Payload|length=variable length|text=Optional. Payload for the different kind of answers; can be an arbitrary length, left to implementation detail.}} Most Linux systems use a unique ''Identifier'' for every ping process, and ''Sequence number'' is an increasing number within that process. Windows uses a fixed ''Identifier'', which varies between Windows versions, and a ''Sequence number'' that is only reset at boot time. The ''Echo Reply'' is returned as: {{APHD|start|header=no|title=ICMP ''Echo Reply'' packet}} {{APHD|20|bits1=8|field1=Type|value1=0|background1=mistyrose|bits2=8|field2=Code|value2=0|background2=mistyrose|bits3=16|field3=Checksum|background3=mistyrose}} {{APHD|24|bits1=16|field1=Identifier|background1=mistyrose|bits2=16|field2=Sequence number|background2=mistyrose}} {{APHD|28|bits1=0|field1=(Payload)|background1=linen}} {{APHD|end}} ;{{APHD|def|name=Type|length=8 bits|text=Set to 0 to indicate 'Echo Reply'.{{Ref RFC|792|rp14}}}} ;{{APHD|def|name=Identifier|length=16 bits|text=Copied from the ''Echo Request'' and returned.}} ;{{APHD|def|name=Sequence number|length=16 bits|text=Copied from the ''Echo Request'' and returned.}} ;{{APHD|def|name=Payload|length=variable length|text=Optional. Payload is copied from the ''Echo Request'' and returned.}} ===ICMPv6 packet transported with IPv6=== An ICMP packet transported with IPv6 looks like this. {{APHD|start|title=IPv6 datagram}} {{APHD|0|bits1=4|field1=Version|value1=6|bits2=8|field2=Traffic class|bits3=20|field3=Flow label}} {{APHD|4|bits1=16|bits2=8|bits3=8|field1=Payload length|field2=Next header|value2=58|hint2=Set to 58 to indicate ICMPv6.|field3=Hop limit}} {{APHD|8|bits1=128|field1=Source address}} {{APHD|24|bits1=128|field1=Destination address}} {{APHD|end}} {{APHD|start|header=no|title=ICMPv6 ''Echo Request'' packet}} {{APHD|40|bits1=8|field1=Type|value1=128|background1=mistyrose|bits2=8|field2=Code|value2=0|background2=mistyrose|bits3=16|field3=Checksum|background3=mistyrose}} {{APHD|44|bits1=16|field1=Identifier|background1=mistyrose|bits2=16|field2=Sequence number|background2=mistyrose}} {{APHD|48|bits1=0|field1=(Payload)|background1=linen}} {{APHD|end}} ;{{APHD|def|name=Type|length=8 bits|text=Set to 128 to indicate 'Echo Request'.}} ;{{APHD|def|name=Identifier|length=16 bits|text=Can be used by the client to match the reply with the request that caused the reply.}} ;{{APHD|def|name=Sequence number|length=16 bits|text=Can be used by the client to match the reply with the request that caused the reply.}} ;{{APHD|def|name=Checksum|length=16 bits|text=The checksum is calculated from the ICMP message (starting with the ''Type'' field), prepended with an IPv6 ''pseudo-header''.{{Ref RFC|4443}}}} ;{{APHD|def|name=Payload|length=variable length|text=Optional. Payload for the different kind of answers; can be an arbitrary length, left to implementation detail.}} Most Linux systems use a unique ''Identifier'' for every ping process, and ''Sequence number'' is an increasing number within that process. Windows uses a fixed ''Identifier'', which varies between Windows versions, and a ''Sequence number'' that is only reset at boot time. The ''Echo Reply'' is returned as: {{APHD|start|header=no|title=ICMPv6 ''Echo Reply'' packet}} {{APHD|40|bits1=8|field1=Type|value1=129|background1=mistyrose|bits2=8|field2=Code|value2=0|background2=mistyrose|bits3=16|field3=Checksum|background3=mistyrose}} {{APHD|44|bits1=16|field1=Identifier|background1=mistyrose|bits2=16|field2=Sequence number|background2=mistyrose}} {{APHD|48|bits1=0|field1=(Payload)|background1=linen}} {{APHD|end}} ;{{APHD|def|name=Type|length=8 bits|text=Set to 129 to indicate 'Echo Reply'.}} ;{{APHD|def|name=Identifier|length=16 bits|text=Copied from the ''Echo Request'' and returned.}} ;{{APHD|def|name=Sequence number|length=16 bits|text=Copied from the ''Echo Request'' and returned.}} ;{{APHD|def|name=Payload|length=variable length|text=Optional. Payload is copied from the ''Echo Request'' and returned.}} ===Payload=== The payload of the packet is generally filled with [[ASCII]] characters, as the output of the [[tcpdump]] utility shows in the last 32 bytes of the following example (after the eight-byte ICMP header starting with {{Mono|0x0800}}): <syntaxhighlight lang="hexdump">16:24:47.966461 IP (tos 0x0, ttl 128, id 15103, offset 0, flags [none], proto: ICMP (1), length: 60) 192.168.146.22 > 192.168.144.5: ICMP echo request, id 1, seq 38, length 40 0x0000: 4500 003c 3aff 0000 8001 5c55 c0a8 9216 E..<:.....\U.... 0x0010: c0a8 9005 0800 4d35 0001 0026 6162 6364 ......M5...&abcd 0x0020: 6566 6768 696a 6b6c 6d6e 6f70 7172 7374 efghijklmnopqrst 0x0030: 7576 7761 6263 6465 6667 6869 uvwabcdefghi </syntaxhighlight> The payload may include a timestamp indicating the time of transmission and a sequence number, which are not found in this example. This allows ping to compute the round-trip time in a [[stateless server|stateless]] manner without needing to record the time of transmission of each packet. The payload may also include a ''magic packet'' for the [[Wake-on-LAN]] protocol, but the minimum payload, in that case, is longer than shown. The ''Echo Request'' typically does not receive any reply if the host was sleeping in hibernation state, but the host still wakes up from sleep state if its interface is configured to accept wakeup requests. If the host is already active and configured to allow replies to incoming ICMP ''Echo Request'' packets, the returned reply should include the same payload. This may be used to detect that the remote host was effectively woken up, by repeating a new request after some delay to allow the host to resume its network services. If the host was just sleeping in low power active state, a single request wakes up that host just enough to allow its ''Echo Reply'' service to reply instantly if that service was enabled. The host does not need to wake up all devices completely and may return to low-power mode after a short delay. Such configuration may be used to avoid a host to enter in hibernation state, with much longer wake-up delay, after some time passed in low power active mode.{{Citation needed|date=May 2016}} A packet including IP and ICMP headers must not be greater than the [[maximum transmission unit]] of the network, or risk being [[IP fragmentation|fragmented]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)