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)
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!
{{Short description|Network utility used to test the reachability of a host}} {{lowercase}} {{Use dmy dates|date=August 2020}} {{Infobox software | name = | title = Ping | screenshot = Ping iputils screenshot.png | caption = Linux version of ping | screenshot size = | screenshot alt = | collapsible = | author = [[Mike Muuss]] | developer = Various [[open-source software|open-source]] and [[commercial software|commercial]] developers | released = {{Start date and age|1983}} | latest release version = | latest release date = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} --> | programming language = | platform = [[Cross-platform]] | genre = [[Command (computing)|Command]] | license = [[Public-domain software|Public-domain]], [[BSD License|BSD]], [[GPL]], [[MIT License|MIT]] | website = | standard = | AsOf = }} '''ping''' is a [[computer network]] administration [[software utility]] used to test the reachability of a [[host (network)|host]] on an [[Internet Protocol]] (IP) network. It is available in a wide range of [[operating system]]s {{endash}} including most embedded network administration software. Ping measures the [[round-trip time]] for messages sent from the originating host to a destination computer that are echoed back to the source. The name comes from [[active sonar]] terminology that sends a [[Pulse (signal processing)|pulse]] of sound and listens for the [[echo]] to detect objects under water.<ref name="ping" /> Ping operates by means of [[Internet Control Message Protocol]] (ICMP) [[Network packet|packet]]s. ''Pinging'' involves sending an '''ICMP echo request''' 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 (average)|mean]] round-trip times, and [[standard deviation]] of the mean. [[Command-line option]]s and [[Computer terminal|terminal]] output vary by implementation. Options may include the size of the payload, count of tests, limits for the number of network hops ([[Time to live#IP packets|TTL]]) that probes traverse, interval between the requests and time to wait for a response. Many systems provide a companion utility ping6, for testing on [[Internet Protocol version 6]] (IPv6) networks, which implement [[ICMPv6]]. ==History== [[File:Cmd-ping.png|thumb|DOS version of ping]] The ping utility was written by [[Mike Muuss]] in December 1983 during his employment at the [[Ballistic Research Laboratory]], now the [[US Army Research Laboratory]]. A remark by [[David L. Mills|David Mills]] on using ICMP echo packets for IP network diagnosis and measurements prompted Muuss to create the utility to troubleshoot network problems.<ref name="ping" /> The author named it after the sound that [[sonar]] makes since its methodology is analogous to sonar's echolocation.<ref name="ping">{{cite web | author = Mike Muuss | author-link = Mike Muuss | title=The Story of the PING Program | url=https://ftp.arl.army.mil/~mike/ping.html | archive-url = https://web.archive.org/web/20191025013201/https://ftp.arl.army.mil/~mike/ping.html | publisher = U.S. Army Research Laboratory | archive-date = 25 October 2019 | url-status = live | access-date = 8 September 2010 | quote = My original impetus for writing PING for 4.2a BSD UNIX came from an offhand remark in July 1983 by Dr. Dave Mills ... I named it after the sound that a sonar makes, inspired by the whole principle of echo-location ... From my point of view PING is not an acronym standing for Packet InterNet Grouper, it's a sonar analogy. However, I've heard second-hand that Dave Mills offered this expansion of the name, so perhaps we're both right. }}</ref><ref>{{cite book |last=Salus |first=Peter |author-link=Peter Salus |title=A Quarter Century of UNIX |publisher=[[Addison-Wesley]] |year=1994 |isbn=978-0-201-54777-1 }}</ref> The [[backronym]] Packet InterNet Groper for PING has been used for over 30 years. Muuss says that, from his point of view, PING was not intended as an acronym but he has acknowledged Mills' expansion of the name.<ref name="ping" /><ref name="davidmills">{{cite IETF | title = Internet Delay Experiments | rfc = 889 | last1 = Mills | first1 = D.L. | author-link1 = David L. Mills | date = December 1983 | publisher = [[IETF]] | access-date = 26 November 2019 }}</ref> The first released version was [[public domain software]]; all subsequent versions have been licensed under the [[BSD license]]. Ping was first included in [[4.3BSD]].<ref>{{Cite web|url=http://www.manpagez.com/man/8/ping/|title=man page ping section 8|website=www.manpagez.com}}</ref> The [[FreeDOS]] version was developed by Erick Engelke and is licensed under the [[GPL]].<ref>{{Cite web|url=http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/ping.html|title=ibiblio.org FreeDOS Package -- ping (Networking)|website=www.ibiblio.org}}</ref> Tim Crawford developed the [[ReactOS]] version. It is licensed under the [[MIT License]].<ref>{{Cite web|url=https://github.com/reactos/reactos|title=GitHub - reactos/reactos: A free Windows-compatible Operating System.|date=8 August 2019|via=GitHub}}</ref> Any host must process ICMP echo requests and issue echo replies in return.{{Ref RFC|1122|quote=Every host MUST implement an ICMP Echo server function that receives Echo Requests and sends corresponding Echo Replies.}} ==Invocation example== The following is the output of running ping on Linux for sending five probes (1-second interval by default, configurable via -i option) to the target host ''www.example.com'': <syntaxhighlight lang="console"> $ ping -c 5 www.example.com PING www.example.com (93.184.216.34): 56 data bytes 64 bytes from 93.184.216.34: icmp_seq=0 ttl=56 time=11.632 ms 64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=11.726 ms 64 bytes from 93.184.216.34: icmp_seq=2 ttl=56 time=10.683 ms 64 bytes from 93.184.216.34: icmp_seq=3 ttl=56 time=9.674 ms 64 bytes from 93.184.216.34: icmp_seq=4 ttl=56 time=11.127 ms --- www.example.com ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 9.674/10.968/11.726/0.748 ms </syntaxhighlight> The output lists each probe message and the results obtained. Finally, it lists the statistics of the entire test. In this example, the shortest [[round-trip time]] was 9.674 ms, the average was 10.968 ms, and the maximum value was 11.726 ms. The measurement had a [[standard deviation]] of 0.748 ms. ==Error indications== In cases of no response from the target host, most implementations display either nothing or periodically print notifications about timing out. Possible ping results indicating a problem include the following: * {{Mono|H,}} {{Mono|!N}} or {{Mono|!P}}{{snd}} host, network or protocol unreachable * {{Mono|S}}{{snd}} source route failed * {{Mono|F}}{{snd}} fragmentation needed * {{Mono|U}} or {{Mono|!W}}{{snd}} destination network/host unknown * {{Mono|I}}{{snd}} source host is isolated * {{Mono|A}}{{snd}} communication with destination network administratively prohibited * {{Mono|Z}}{{snd}} communication with destination host administratively prohibited * {{Mono|Q}}{{snd}} for this [[Type of service|ToS]] the destination network is unreachable * {{Mono|T}}{{snd}} for this ToS the destination host is unreachable * {{Mono|X}}{{snd}} communication administratively prohibited * {{Mono|V}}{{snd}} host precedence violation * {{Mono|C}}{{snd}} precedence cutoff in effect In case of error, the target host or an intermediate router sends back an ICMP error message, for example ''host unreachable'' or ''TTL exceeded in transit''. In addition, these messages include the first eight bytes of the original message (in this case header of the ICMP echo request, including the quench value), so the ping utility can match responses to originating queries.<ref>{{Cite web | url = http://repo.hackerzvoice.net/depot_madchat/ebooks/TCP-IP_Illustrated/icmp_int.htm | title = ICMP: Internet Control Message Protocol | date = 13 January 2000 | access-date = 4 December 2014 | website = repo.hackerzvoice.net | archive-url = https://web.archive.org/web/20160804032607/http://repo.hackerzvoice.net/depot_madchat/ebooks/TCP-IP_Illustrated/icmp_int.htm | archive-date = 4 August 2016 | url-status = dead }}</ref> ==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]]. ==Security loopholes== To conduct a [[denial-of-service attack]], an attacker may send ping requests as fast as possible, possibly overwhelming the victim with ICMP echo requests. This technique is called a [[ping flood]].<ref>{{Cite web|title=What is a Ping Flood {{!}} ICMP Flood {{!}} DDoS Attack Glossary {{!}} Imperva|url=https://www.imperva.com/learn/ddos/ping-icmp-flood/|access-date=2021-07-26|website=Learning Center|language=en-US}}</ref> Ping requests to multiple addresses, [[ping sweep]]s, may be used to obtain a list of all hosts on a network. ==See also== {{Div col|colwidth=20em}} * [[fping]] * [[hping]] * [[Keepalive]] * [[nping]] * [[PathPing]] * [[Ping of death]] * [[Ping-pong scheme]] * [[Smurf attack]] * [[Traceroute]] {{div col end}} ==References== {{Reflist}} ==Further reading== *{{Cite book |author-last=Dyson |author-first=Peter |year=1995 |url=https://archive.org/details/masteringos2warp0000dyso |title=Mastering OS/2 Warp |publisher=[[Sybex]] |isbn=978-0782116632 |url-access=registration}} *{{Cite book|author=John Paul Mueller|year=2007|title=Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000|publisher=[[John Wiley & Sons]]|isbn=978-0470165799}} *{{Cite book|author-last=McElhearn|author-first=Kirk|title=The Mac OS X Command Line: Unix Under the Hood|date=2006|publisher=[[John Wiley & Sons]]|isbn=978-0470113851}} ==External links== {{Wikibooks|Guide to Windows Commands}} * {{man|1m|ping|Solaris}} * {{man|8|ping|FreeBSD}} * {{man|8|ping|Linux}} * [https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/ping ping] at [[Microsoft Docs]] {{Clear}} {{Unix commands}} {{Windows commands}} [[Category:Free network management software]] [[Category:Internet Protocol based network software]] [[Category:Network analyzers]] [[Category:OS/2 commands]] [[Category:Unix network-related software]] [[Category:Windows administration]] [[Category:Windows communication and services]]
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)
Pages transcluded onto the current version of this page
(
help
)
:
Template:APHD
(
edit
)
Template:Citation needed
(
edit
)
Template:Cite IETF
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Clear
(
edit
)
Template:Div col
(
edit
)
Template:Div col end
(
edit
)
Template:Endash
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Lowercase
(
edit
)
Template:Main other
(
edit
)
Template:Man
(
edit
)
Template:Mono
(
edit
)
Template:Ref RFC
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Sister project
(
edit
)
Template:Snd
(
edit
)
Template:Template other
(
edit
)
Template:Unix commands
(
edit
)
Template:Use dmy dates
(
edit
)
Template:Wikibooks
(
edit
)
Template:Windows commands
(
edit
)