Advanced Ping usage

Source: Internet
Author: User

Advanced Ping usage
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. 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 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. 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. 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 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
Okay, I copied the ping command. I will keep up with my questions.

★Ping parameter (reproduced)

Ping Parameters

-A converts the target machine ID to an IP address.
-T if the user is not interrupted manually, the Ping will continue.
-C count requires the ping command to send packets continuously until the packets are sent and received count requests
-D: Enable the debugging status for the socket used
-F is a fast ping method. The Ping output packet speed is as fast or faster as the packet returned from the remote host, reaching 100 times per second. In this way, each request is represented by a period. Print a Space key for each response.
-I seconds specifies the number of seconds between two packets. It cannot be used together with-f.
-N only uses numbers. In general, Ping attempts to convert the IP address to the host name. This option requires ping to print the IP address without looking for the name represented by a symbol. This option is important if you cannot use the local DNS server for some reason.
-P pattern supports the use of this option to identify 16 pad bytes and add these bytes to the data packet. This option is useful when diagnosing data-related errors in the network.
-Q: The ping command only prints some summary information at the start and end.
-R adds the ICMP record-route option to the echo_request data packet and records the route in the data packet. In this way, when the data is returned, ping the data to print the route information. Each packet can only record nine route nodes. Many hosts ignore or discard this option.
-R causes the ping command to bypass the normal route table used to send data packets.
-S packetsize allows you to identify the number of bytes of data to be sent. The default value is 56 characters, plus 8 bytes of ICMP data header. A total of 64 ICMP data bytes are added.
-V puts Ping in verbose mode. In addition to printing the echo-response packet, the ping command also prints all other returned ICMP packets.
Supplement again

Ping Command-
The connection between the school administrator and the local computer. This command can be used only after the secure TCP/IP protocol.
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
Metric data
-T
The school administrator is connected to the specified computer until the specified computer is used.
-
Resolve the address to the computer name.
-N count
Sends the specified number of ECHO texts by count, and the default value is 4.
-L Length
Sends an echo response that contains the Data Length Specified by length. The default value is 64-character, and the maximum value is 8192-character.
-F
In the package, the "Do Not segment" tag is sent. The package will not be segmented by the network-related segments on the route.
-I TTL
Set the "survival time" field to the data value specified by TTL.
-V TOS
Set the "service type" field to the value specified by the TOS.
-R count
In the "record routing" field, record the route that sends the response and returns the response. The minimum value of the specified count can be 1 or 9.
-S count
Specifies the time stamp for the number of rounds specified by count.
-J computer-list
The route entry of the computer list specified by computer-list. Internetswitches may separate compute computers (Loose Source Routing ). The maximum number of IP addresses allowed is 9.
-K computer-list
The route entry of the computer list specified by computer-list. Internetswitches may be used to separate compute (lattice source route ). The maximum number of IP addresses allowed is 9.
-W timeout
Specify the ultra-time interval in milliseconds.
Destination-list
Specifies the computer on which the primary node is to be connected.
Ping-related zookeeper Information
Ping -- Note
The Ping Command sends ICMP response text to the computer and listens to the response text. It is connected to the computer or local computer. For each sent text, Ping can wait up to 1 second, and print the number of sent and received text. Verify the validity of each receiver and sender. In an emotional situation, four response texts are sent, each of which contains 64-character data (a periodic bigbench letter sequence ).
You can use the Ping program to calculate the Host Name and IP address. If the IP address of the primary account cannot be successfully resolved, it indicates that there is a problem with the name resolution. In this case, you need to save it in the local hosts file or DNS
There is a computer name for data query.
The following example shows the ping command output: (for Windows, start is available: Start is used> Run is run. When "command" is run, run this command in the Command window)
C:/> Ping ds.internic.net
Pinging ds.internic.net [192.20.239.132] with 32 bytes of data:
Reply from 192.20.239.132: bytes = 32 time = 101 Ms TTL = 243
Reply from 192.20.239.132: bytes = 32 time = 100 ms TTL = 243
Reply from 192.20.239.132: bytes = 32 time = 120 ms TTL = 243
Reply from 192.20.239.132: bytes = 32 time = 120 ms TTL = 243

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.