Current location - Quotes Website - Personality signature - [Help] How to use the PING command
[Help] How to use the PING command
Usage of ping command

Advanced usage of ping

I believe everyone is familiar with the ping command under Windows, but not many people can maximize the ping function. Of course, I'm not saying that the ping function can be maximized. I just often use the ping tool, and I have also summed up some small experiences. Now I will share them with you.

Now I will refer to the help description of the ping command to tell 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 it stops. View statistics and continue-invalid control-interrupt; Stop invalid control.

Keep ping the local host 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 resolves the address to a host name.

Resolve the NetBios name of the computer.

For example: c: \ > ping-a192.168.1.21

Ping iceblood.yofor.com with 32 bytes of data [192.168.1.21]:

Reply from192.168.1.21:bytes = 32 time <; 10ms TTL=254

Reply from192.168.1.21:bytes = 32 time <; 10ms TTL=254

Reply from192.168.1.21:bytes = 32 time <; 10ms TTL=254

Reply from192.168.1.21:bytes = 32 time <; 10ms TTL=254

Ping statistics are192.168.1.21:

Packet: sending = 4, receiving = 4, loss = 0 (0% loss), approximate round-trip time in milliseconds:

Minimum value = 0 ms, maximum value = 0 ms and average value = 0 ms.

From the above, we can know that the NetBios of the computer with IP 192. 168. 1 is called iceblood.yofor.com.

-n count the number of echo requests to send.

Send the number of echo packets specified by count.

By default, only four packets are usually sent. You can define the number of packets you send through this command, which is very helpful for calculating the network speed. For example, I want to test the average time, the fastest time and the slowest time to send 50 packets, and I can get the following information:

c:\ & gt; Ping -n 50 202. 103.96.68

Ping 202 with 32 bytes of data.103.96.68:

202. 103.96.68 reply: byte =32 time =50ms TTL=24 1

202. 103.96.68 reply: byte =32 time =50ms TTL=24 1

202. 103.96.68 reply: byte =32 time =50ms TTL=24 1

The request timed out.

………………

202. 103.96.68 reply: byte =32 time =50ms TTL=24 1

202. 103.96.68 reply: byte =32 time =50ms TTL=24 1

202. Ping statistics of103.96.68:

Packet: send = 50, receive = 48, lose = 2 (4% lost), approximate round-trip time in milliseconds:

Minimum value = 40ms, maximum value = 5 1 ms, and average value = 46ms.

As can be seen from the above, in the process of sending 50 packets to 202. 103.96.68, 48 packets were returned, and two of them were lost for unknown reasons. The fastest return speed of these 48 packets is 40ms, the slowest is 5 1ms, and the average speed is 46 ms.

-l size send buffer size.

Defines the size of the loopback packet.

The default packet size sent by windows ping is 32byt, and we can also define the size ourselves, but there is a size limit, that is, we can only send 65,500 Byt at most. Some people may ask why it should be limited to 65,500 Byt, because all Windows series systems have a security loophole (perhaps including other systems), that is, when the data packet sent to the other party at one time is greater than or equal to 65,532, the other party is likely to block the machine. Although Microsoft has made this restriction, this parameter is still very harmful when combined with other parameters. For example, we can achieve an aggressive command by matching the -t parameter: (The following description is dangerous and is only used for experiments. Please don't apply it to other people's machines easily, or you will be at your own risk.

c:\ & gt; Ping-l65500-t192.168.1.21

Ping192.168.1.21,containing 65,500 bytes of data:

Reply from192.168.1.21:bytes = 65500time <; 10ms TTL=254

Reply from192.168.1.21:bytes = 65500time <; 10ms TTL=254

………………

In this way, it will continuously send packets with the size of 65500byt to 192. 168. 1 computer. If you only have one computer, it may not be effective, but if you have multiple computers, you can completely paralyze each other. I have done such an experiment. When I used 10 computers to ping a computer with Win2000Pro system at the same time, in less than 5 minutes, the other party's network was completely paralyzed, the network was seriously blocked, and the HTTP and FTP services stopped completely. This shows that power is no small matter.

-f sets the no segmentation flag in the packet.

Send a "Do not segment" flag in the packet.

Generally speaking, the packet you send will be segmented according to the route and then sent to the other party. After adding this parameter, the route will not be segmented again.

-I want to live.

Specify how long TTL value stays in the other system.

This parameter also helps you check the network operation.

-v TOS is invalid for the service.

Set the service type field to the value specified by tos.

-r count records the hop count of the route.

Record the routing of outgoing and returning packets in the Record Routing field.

Generally speaking, the packet you sent reached the other party through a route, but which routes did you pass? You can set the number of routes you want to detect through this parameter, but it is limited to nine, which means that you can only track nine routes. If you want to detect more, you can do it through other commands, which I will explain to you in a future article. Here is an example:

c:\ & gt; Ping-n1-r9202.96.105.1kloc-0/(send a packet and record up to 9 routes).

Ping 202.96.105.101:

Reply from 202.96.105.101:bytes = 32time =10ms TTL = 249.

Route: 202. 107.208. 187->

202. 107.2 10.2 14->;

6 1. 153. 1 12.70->;

6 1. 153. 1 12.89->;

202.96. 105. 149 ->

202.96. 105.97 ->

202 . 96 . 105 . 10 1->

202.96. 105. 150 ->

6 1. 153. 1 12.90

Ping statistics are 202.96.105.101:

Packet: send = 1, receive = 1, loss = 0 (0% loss),

Approximate round-trip time in milliseconds:

Minimum value =10ms, maximum value =10ms, and average value =10ms.

From the above, we can know that from my computer to 202.96.105.101,a * * passed 202.6438+007.2087, 2002.107.10087.100080808806

Count timestamp of -s count hops.

Specifies the timestamp of the hop count specified by count.

This parameter is similar to -r, except that this parameter does not record the routes returned by packets, and only records four at most.

-j host-list is routed along the loose source of host-list.

Routes packets using the computer list specified by computer-list. Continuous computers can be separated by intermediate gateways (routing sparse sources). The maximum number allowed by IP is 9.

-k host-list strict source routing along the host-list.

Routes packets using the computer list specified by computer-list. Continuous computers cannot be separated by intermediate gateways (routing is strictly from sources). The maximum number of IPS allowed is 9.

-w timeout The timeout (in milliseconds) for waiting for each reply.

Specifies the timeout interval in milliseconds.

There is no other trick for this parameter.

Other skills of ping command: In general, you can roughly judge whether the system type of the target host is Windows series or UNIX/Linux series by pinging the TTL value returned by the other party. Under normal circumstances, the TTL value returned by Windows series systems is between 100- 130. The TTL value returned by UNIX/Linux system is between 240 and 255. Of course, TTL value can be modified in the other host, and Windows system can realize it by modifying the following key values in the registry:

[HKEY _ LOCAL _ MACHINE \ SYSTEM \ current control set \ Services \ Tcpip \ Parameters]

" DefaultTTL"=dword:000000ff

255 - FF

128 - 80

64 - 40

32 - 20

Ok, I basically copied the ping command. If you have any questions, please post it.

/news/22/23 1.html

Detailed description of ping command parameters

-a converts the machine identification of the target into an ip address.

-t If the user does not interrupt, he will continue to ping.

-c count requires the ping command to send packets continuously until the count request is sent and received.

-d Open the debug status of the socket used.

-f is a shortcut to ping. So that the speed of ping packets is as fast as that of packets returned from remote hosts, or even faster, reaching 100 times per second. In this way, each request is represented by a period. Print a space bar for each answer.

-1 sec is a specific number of seconds between packet transmissions. Cannot be used with-f.

-n Use only numbers. Under normal circumstances, ping will try to translate an IP address into a host name. This option requires ping to print the IP address without looking for the symbol name. This option is very important if the local DNS server cannot be used for some reason.

-p mode supports 16 padding bytes that can be identified by this option and added to the packet. This option is useful when diagnosing data-related errors in the network.

-q causes ping to print some summary information only at the beginning and end.

-R Add the ICMP RECORD-ROUTE option to the ECHO_REQUEST packet, requiring that the route be recorded in the packet, so that ping can print out the route information when the data returns. Each packet can only record 9 routing nodes. Many hosts ignore or discard this option.

-r causes the ping command to bypass the normal routing table to send packets.

-s packetsize enables the user to determine the number of bytes of data to be sent. The default value is 56 characters, plus 8 bytes of ICMP header and ***64 ICMP data bytes.

-v puts ping in verbose mode. ICMP expects the ping command to print all other returned internet control message protocols except the ECHO-RESPONSE packet.

Replenish again

Ping command-detailed help

Verify the connection to a remote computer or local computer. This command 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.

parameter

Equivalent to -ED

Verify the connection to the specified computer until the user disconnects.

[Ancient names or Latin modern names of animals and plants]

Resolve the address to a computer name.

-n count

Send the number of echo messages specified by count. The default value is 4.

-l length

Sends an ECHO message containing the data length specified by length. The default value is 64 bytes and the maximum value is 8 192 bytes.

-f

Send the "Do not segment" flag in the packet. The packet will not be segmented by the gateway on the route.

-I see

Set the time-to-live field to the value specified by ttl.

-v tos

Set the service type field to the value specified by tos.

-r count

Record the route of outgoing and return messages in the Record Route field. The minimum value of the specified count can be 1 and the maximum value can be 9.

-s count

A timestamp that specifies the number of forwards specified by count.

-j computer-list

Routes messages through the computer list specified by computer-list. Intermediate gateways can separate consecutive computers (loose source routing). A maximum of 9 IP addresses are allowed.

-k computers-list

Routes messages through the computer list specified by computer-list. Intermediate gateways can separate successive computers (strict source routing). A maximum of 9 IP addresses are allowed.

-w timeout

Specifies the timeout interval in milliseconds.

Destination list

Specify a remote computer to verify the connection.

More information about Ping

Ping-attention

The Ping command verifies the connection with a remote computer or a local computer by sending an ICMP echo message to the computer and listening for the return of the echo message. For each message sent, Ping waits at most 1 second, and prints the number of messages sent and received. Compare each message received with the message sent to verify its validity. By default, four response messages are sent, each containing 64 bytes of data (periodic capital letter sequence).

You can use the Ping utility to test the computer name and IP address. If the IP address can be successfully verified, but the computer name cannot be successfully verified, there is a problem with name resolution. In this case, make sure it is in the local host file or DNS.

The computer name to be queried exists in the database.

The following shows an example of Ping output: (available to Windows users: Go-& gt;; Run, enter "command" to bring up the command window.

c:\ & gt; Ping ds.internic.net

Ping ds.interactive.net with 32 bytes of data [192.20.239.132]:

192.20.239. 132 reply: byte =32 time = 10 1ms TTL=243.

192.20.239. 132 reply: byte =32 time = 100ms TTL=243.

192.20.239. 132 reply: byte =32 time = 120ms TTL=243.

192.20.239. 132 reply: byte =32 time = 120ms TTL=243.