Ping Command details

Source: Internet
Author: User
I believe everyone is familiar with the ping command in windows, but there are not many people who can make the most of the Ping function, of course, I am not saying that I can allow ping to play its biggest function. I just often use the ping tool and summarize some small experiences. I would like to share it with you now.
Now I will refer to the help instructions of the ping command to show you the skills I will use when using ping. Ping can only be used after the TCP/IP protocol is installed:
Ping [-T] [-A] [-N count] [-l length] [-F] [-I TTL] [-V TOS] [-r count] [- s count] [[-J computer-list] | [-K computer-list] [-W timeout] destination-list
Options:
-T ping the specified host until stopped. To see statistics and continue-type control-break; to stop-type control-C.
Ping the host continuously until you press control-C.
This function has no special skills, but it can be used with other parameters, which will be mentioned below.

-A resolve addresses to hostnames.
Resolve the NetBIOS Name of the computer.
Example: C :\> Ping-A 192.168.1.21
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
Reply from 192.168.1.21: bytes = 32 time <10 ms TTL = 254
Reply from 192.168.1.21: bytes = 32 time <10 ms TTL = 254
Reply from 192.168.1.21: bytes = 32 time <10 ms TTL = 254
Reply from 192.168.1.21: bytes = 32 time <10 ms TTL = 254
Ping statistics for 192.168.1.21:
Packets: Sent = 4, stored ED = 4, lost = 0 (0% loss), approximate round trip times in Milli-seconds:
Minimum = 0 ms, maximum = 0 ms, average = 0 ms
The NetBIOS Name of the computer whose IP address is 192.168.1.21 is iceblood.yofor.com.

-N count Number of echo requests to send.
Number of echo data packets sent by count.
By default, only four data packets are sent. You can use this command to define the number of sent packets, which is helpful for measuring the network speed, for example, I want to test the average time returned by sending 50 packets, the fastest time, and the slowest time, which can be determined by the following:
C: \> Ping-N 50 202.103.96.68
Pinging 202.103.96.68 with 32 bytes of data:
Reply from 202.103.96.68: bytes = 32 time = 50 ms TTL = 241
Reply from 202.103.96.68: bytes = 32 time = 50 ms TTL = 241
Reply from 202.103.96.68: bytes = 32 time = 50 ms TTL = 241
Request timed out.
..................
Reply from 202.103.96.68: bytes = 32 time = 50 ms TTL = 241
Reply from 202.103.96.68: bytes = 32 time = 50 ms TTL = 241
Ping statistics for 202.103.96.68:
Packets: Sent = 50, stored ED = 48, lost = 2 (4% loss), approximate round trip times in Milli-seconds:
Minimum = 40 ms, maximum = 51 ms, average = 46 Ms
From the above, I can know that 48 data packets are returned when 50 data packets are sent to 202.103.96.68, two of which are lost due to unknown reasons, among the 48 data packets, the return speed is as fast as 40 ms, the slowest is 51 ms, and the average speed is 46 Ms.

-l size send buffer size.
defines the ECHO packet size.
by default, the size of the packets sent by Windows Ping is 32 BYT. You can also define the size of the packets by yourself, but there is a limit on the size, that is, up to BYT can be sent, some may ask why the limit is BYT, because Windows systems have a security vulnerability (or other systems) when a packet sent to the other party is greater than or equal to 65532, the other party is likely to block the server. To solve this security vulnerability, Microsoft restricts the ping packet size. Although Microsoft has made this restriction, this parameter, in combination with other parameters, is still very harmful, for example, we can use the-t parameter to implement an aggressive command: (The following describes Dangerous commands, which are only used for testing. do not apply them to other machines easily; otherwise, the consequences are at your own risk)
C: \> Ping-l 65500-T 192.168.1.21
pinging 192.168.1.21 with 65500 bytes of data:
reply from 192.168.1.21: bytes = 65500 time <10 ms TTL = 254
reply from 192.168.1.21: bytes = 65500 time <10 ms TTL = 254
..................
in this way, it will continuously send packets of 65500byt size to the computer 192.168.1.21. If you only have one computer, it may be ineffective, however, if there are a lot of computers that can completely paralyze the other party, I have done such a test. When I use more than 10 computers to ping a computer in the win2000pro system at the same time, in less than five minutes, the other party's network is completely paralyzed, the network is severely congested, and the HTTP and FTP services are completely stopped. This shows that the power is too small.

-F set don't fragment flag in packet.
Send the "Do Not segment" flag in the data packet.
Generally, the packets you send will be sent to the other party through the route segment. After this parameter is added, the route will not be processed in segments.

-I TTL time to live.
Specifies the time when the TTL value stays in the target system.
This parameter also helps you check the network operation.

-V tos type of service.
Set the "service type" field to the value specified by TOS.

-R count Record Route for Count hops.
Record the routes of outgoing and returned data packets in the "Record Route" field.
In general, the packets you send arrive at each other through routes. But what routes have you received? With this parameter, you can set the number of routes you want to detect, but it is limited to 9, that is, you can only track 9 routes. If you want to detect more, you can use other commands.Article. The following is an example:
C: \> Ping-N 1-r 9 202.96.105.101 (send a packet and record a maximum of 9 routes)

Pinging 202.96.105.101 with 32 bytes of data:

Reply from 202.96.105.101: bytes = 32 time = 10 ms TTL = 249
Route: 202.107.208.187->
202.107.210.214->
61.153.112.70->
61.153.112.89->
202.96.105.149->
202.96.105.97->
202.96.105.101->
202.96.105.150->
61.153.112.90

Ping statistics for 202.96.105.101:
Packets: Sent = 1, stored ED = 1, lost = 0 (0% loss ),
Approximate round trip times in Milli-seconds:
Minimum = 10 ms, maximum = 10 ms, average = 10 ms
From above, I can know that the routes from my computer to 202.96.105.101 have passed 202.107.208.187, listen, 61.153.112.70, 61.153.112.89, 202.96.105.149, and 202.96.105.97.

-S count timestamp for Count hops.
Specifies the timestamp of the number of hops specified by count.
This parameter is similar to-R, but this parameter does not record the route through which the packet returns, and only a maximum of four records are recorded.

-J host-list loose source route along host-list.
Route data packets using the computer list specified by computer-list. The maximum number of consecutive computers that can be separated by the Intermediate Gateway (routing sparse source) IP addresses is 9.

-K host-list strict source route along host-list.
Route data packets using the computer list specified by computer-list. The maximum number of IP addresses allowed by consecutive computers to be separated by intermediate gateways (strictly source routes) is 9.

-W timeout in milliseconds to wait for each reply.
Specify the timeout interval, in milliseconds.
This parameter has no other tips.

other tips for the ping command: In general, You can ping the other side to get the TTL value that the other side returns to you, you can roughly determine whether the system type of the target host is Windows or UNIX/Linux. Generally, the TTL value returned by the Windows system is between and, the TTL value returned by Unix/Linux systems is between and. Of course, the TTL value can be modified in the host of the other party. For Windows systems, you can modify the following key values of the registry:
[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters]
"defaultttl" = DWORD: 000000ff
255---ff
128---80
64----40
32----20
now, the ping command is completely explained, including-J and-K. I have not provided a detailed description of the parameters. for some reasons, I have collected too little information. I have not provided a detailed description here. Please forgive me, if you know more about this article and other tips, I hope you can tell me and thank you first.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.