Ping command - Windows commands Author: Chuwen Time: 2018-05-09 Classification: Windows # ping >Verify an IP level connection to another TCP/IP computer by sending an Internet Control Message Protocol (ICMP) response request message. Display the receiving and round trip time of the corresponding echo response message. Ping is the main TCP/IP command used to solve connectivity, accessibility and name resolution problems. If no parameter is used, ping will display help. ##Note: -By [Xianzai]( https://nowtime.cc )Translated on * * 2018-05-12 20:40 * *, please indicate the source for reprinting! -This command comes from: https://github.com/MicrosoftDocs/windowsserverdocs ##Applicable to - Windows xp、7、8、9 ##Grammar ``` ping [/t] [/a] [/n <Count>] [/l <Size>] [/f] [/I <TTL>] [/v <TOS>] [/r <Count>] [/s <Count>] [{/j <Hostlist> | /k <Hostlist>}] [/w <timeout>] [/R] [/S <Srcaddr>] [/4] [/6] <TargetName> ``` <!-- more--> ###Parameters |Parameter | Description| |-------|--------| |/T | Specifies that ping sends the response request message to the destination continuously until it is interrupted. If you want to break and display statistics, press Ctrl+break; If you want to interrupt and exit * * ping * *, press Ctrl+C| |/A | Specifies to perform reverse name resolution on the target IP address. If successful, ping will display the corresponding hostname| |/N<Count>| Specifies the number of echo request messages sent. The default value is 4| |/L<Size>| Specifies the length (in bytes) of the data field in the echo request message sent. The default value is 32, and the maximum size is 65500 (please refer to the actual information for details)| |/F | Specifies that the Do not Fragment flag in the 'IP header' is set to 1 (only available on IPv4) to send echo request messages. The echo request message cannot be segmented by the router in the destination path. This parameter is useful for solving the problem of path maximum transmission unit (PMTU)| |/I<TTL>| Specify the value of the TTL field in the IP header for the echo request message sent. The default value is the default TTL value of the host. The maximum * TTL * is 255| |/V<TOS>| Specifies the value of the service type (TOS) field in the 'IP header' of the echo request message sent (only applicable to IPv4). The default value is 0* TOS * is specified as a decimal value from 0 to 255| |/R<Count>| Specifies that the "Record Route" option in the "IP Header" is used to record the path used by echo request messages and corresponding echo response messages (only available on IPv4). Each hop in the path uses the entry in the Log Route option. If possible, specify * Count *, which is equal to or greater than the number of hops between the source and target* Count * must be at least 1 and at most 9| |/S<Count>| Specify the * * Internet timestamp * * option in the IP header to record the arrival time of echo request messages and corresponding echo response messages for each hop* Count * must be at least 1 and the maximum value is 4. This is required to link local target addresses| |/J<Hostlist>| Specifies that echo request messages use the loose source routing option in the IP header and a set of intermediate destinations specified in * Hostlist * (only available on IPv4). With loose source routing, consecutive intermediate destinations can be separated by one or more routers. The maximum number of addresses or names in the host list is 9. The host list is a series of IP addresses separated by spaces (in dotted decimal notation)| |/K<Hostlist>| Specifies that echo request messages use the Strict Source Route option in the 'IP header' and a set of intermediate targets specified in the * Hostlist * (only available on IPv4). With strict source routing, the next intermediate target must be directly accessible (it must be a neighbor on the router interface). The maximum number of addresses or names in the host list is 9. The host list is a series of IP addresses separated by spaces (in dotted decimal notation)| |/W<timeout>| Specifies the amount of time (in milliseconds) to wait for a reply message, which corresponds to the given echo request message to be received. If no response response message is received within the timeout period, the request timeout error message is displayed. The default timeout is 4000 milliseconds (4 seconds)| |/R | The specified round-trip path is tracked (only available on IPv6)| |/S<Srcaddr>| Specifies the source address to use (only available on IPv6)| |/4 | Specify IPv4 for ping. This parameter is not required to identify a target host using an IPv4 address. Only the target host needs to be identified by name| |/6 | Specify IPv6 for ping. This parameter is not required to identify the target host using an IPv6 address. Only the target host needs to be identified by name| |<TargetName>| Specify the host name or IP address of the target| |/?| Displays help at the command prompt| ##Remarks -You can use * * ping * * to test the computer name and IP address of the computer. If you succeed in pinging the IP address, but fail in pinging the computer name, you may encounter name resolution problems. In this case, please ensure that the computer name you specify can be resolved through the local host file, using Domain Name System (DNS) query or NetBIOS name resolution technology. -This command can only be used if the Internet Protocol (TCP/IP) protocol is installed as a component in the network adapter properties of the network connection. ##Example 1. The following example shows the * * ping * * command output: ``` C:\>ping nowtime.cc Ping nowtime.cc [104.24.127.155] with 32 bytes of data: Reply from 104.24.127.155: byte=32 time=208ms TTL=52 Reply from 104.24.127.155: byte=32 time=218ms TTL=51 Reply from 104.24.127.155: byte=32 time=206ms TTL=52 Reply from 104.24.127.155: byte=32 time=214ms TTL=51 Ping statistics of 104.24.127.155: Packets: Sent=4, Received=4, Lost=0 (0% Lost), Estimated time of round trip (in milliseconds): Minimum=206ms, maximum=218ms, average=211ms ``` ---------- 2. To ping the target 223.5.5.5 and resolve 223.5.5.5 to its host name, type: ` ping/a 223.5.5.5` >Special note: Not all 'IP addresses' will be reverse resolved ``` C:\>ping /a 223.5.5.5 Ping public1.alidns.com [223.5.5.5] with 32 bytes of data: Reply from 223.5.5.5: byte=32 time=26ms TTL=54 Reply from 223.5.5.5: byte=32 time=26ms TTL=54 Reply from 223.5.5.5: byte=32 time=26ms TTL=54 Reply from 223.5.5.5: byte=32 time=26ms TTL=54 223.5.5.5 Ping statistics: Packets: Sent=4, Received=4, Lost=0 (0% Lost), Estimated time of round trip (in milliseconds): Min=26ms, Max=26ms, Average=26ms ``` ---------- 3. To ping the destination '223.5.5.5' with 10 echo request messages, and each message has a 1000 byte data field, enter 'ping/n 10/l 1000 223.5.5.5` ``` C:\>ping /n 10 /l 1000 223.5.5.5 Ping 223.5.5.5 data with 1000 bytes: Reply from 223.5.5.5: byte=1000 time=27ms TTL=54 Reply from 223.5.5.5: byte=1000 time=26ms TTL=54 Reply from 223.5.5.5: byte=1000 time=27ms TTL=54 Reply from 223.5.5.5: byte=1000 time=27ms TTL=54 Reply from 223.5.5.5: byte=1000 time=26ms TTL=54 Reply from 223.5.5.5: byte=1000 time=27ms TTL=54 Reply from 223.5.5.5: byte=1000 time=27ms TTL=54 Reply from 223.5.5.5: byte=1000 time=26ms TTL=54 Reply from 223.5.5.5: byte=1000 time=27ms TTL=54 Reply from 223.5.5.5: byte=1000 time=27ms TTL=54 223.5.5.5 Ping statistics: Packets: Sent=10, Received=10, Lost=0 (0% Lost), Estimated time of round trip (in milliseconds): Minimum=26ms, maximum=27ms, average=26ms ``` ---------- 4. To ping the target 127.0.0.1 and record the 4-hop route, type: ` ping/r 4 127.0.0.1` ``` C:\>ping /r 4 127.0.0.1 Ping 127.0.0.1 data with 32 bytes: Reply from 127.0.0.1: byte=32 time<1ms TTL=128 Reply from 127.0.0.1: byte=32 time<1ms TTL=128 Reply from 127.0.0.1: byte=32 time<1ms TTL=128 Reply from 127.0.0.1: byte=32 time<1ms TTL=128 Ping statistics of 127.0.0.1: Packets: Sent=4, Received=4, Lost=0 (0% Lost), Estimated time of round trip (in milliseconds): Min=0ms, Max=0ms, Average=0ms ``` ---------- 5. To display help at the command prompt, type: ` ping/` ``` C:\>ping /? Usage: ping [- t] [- a] [- n count] [- l size] [- f] [- i TTL] [- v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] [-R] [-S srcaddr] [-c compartment] [-p] [-4] [-6] target_name Options: -T Ping the specified host until it stops. To view statistics and continue, type Ctrl+Break; To stop, type Ctrl+C. -A resolves the address to the hostname. -N count Number of echo requests to send. -L size Send buffer size. -F Set the No Segmentation flag in the packet (IPv4 only). -I TTL lifetime. -V TOS service type (IPv4 only. This setting has been deprecated, There is nothing for the service type field in the IP header Impact). -R count records the route of count hops (IPv4 only). -S count The timestamp of the count hop (IPv4 only). -J host list Loose source routing used with host list (IPv4 only). -K host list Strict source routing used with host lists (IPv4 only). -W timeout The timeout (in milliseconds) to wait for each reply. -R also uses the route header to test the reverse route (IPv6 only). This routing header has been deprecated according to RFC 5095. If this header is used, some systems may discard Echo request. -The source address to be used by S srcaddr. -C compartment Route compartment identifier. -P Ping the Hyper-V network virtualization provider address. -4 Force IPv4. ``` For more information, please read "Parameters" and explore by yourself label: Command , Windows , Complete set of Windows commands