Maximize the Ping command function

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% lo
Ss), 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. However, there is a size limit, 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 constantly send packets of 65500byt size to the 192.168.1.21 computer. If you only have one computer, it may not work, but if there are many computers, it will completely paralyze the other computer, I once did this experiment. When I used more than 10 computers to ping a Win2000Pro system computer at the same time, the other party's network was completely paralyzed in less than five minutes, and the network was severely congested, the HTTP and FTP services are completely stopped. This shows that the power is too small.
  
-F Set Dont 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 data packet you send is
Routes arrive at each other, but what routes have they passed? 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. I will explain this to you in a later 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. Continuous

The maximum number of IP addresses that can be separated by intermediate gateways (routing sparse source) 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 Timeout in milliseconds to wait for each reply.

  

Specify the timeout interval, in milliseconds.

  

This parameter has no other tips.

  

Other tips of the ping command: In general, You can ping the other side to get the TTL value returned by the other side 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

  

All right, the ping command is basically completely explained, and I have not described the-j and-k parameters in detail yet, for some reason, I have collected too little information. I have not provided you with details here. Please forgive me,
 

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.