Home>Article> Detailed explanation of commonly used ping commands

Detailed explanation of commonly used ping commands

尚
Original
2019-12-18 09:52:32 12385browse

Ping is a command under Windows, Unix and Linux systems. Ping also belongs to a communication protocol and is part of the TCP/IP protocol. You can use the "ping" command to check whether the network is connected, which can help us analyze and determine network faults. The following article will introduce you to some commonly used ping commands.

Detailed explanation of commonly used ping commands

#The ping command is usually used to check network availability. The ping command can send a test packet to a network address to see if there is a response from the network address and count the response time to test the network.

The principle of ping:

Send a data packet of a certain length to the specified network address. According to the agreement, if the specified network address exists, the same will be returned. Of course, if the data packet is not returned within a specific time, it is a "timeout" and it will be considered that the specified network address does not exist.

ICMP protocol is sent through IP protocol, which is a connectionless and unreliable data packet protocol. In Unix/Linux, the serial number starts counting from 0 and increases in sequence. The ICMP sequence number of the Windows ping program is irregular.

ICMP protocol data packet in actual transmission: 20-byte IP header, 8-byte ICMP header, 1472 bytes38 bytes.

ICMP message format: IP header (20 bytes) 8-bit type 8-bit code 16 checksum (different types and codes have different formats).

Usage of ping command

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] [-4] [-6] target_name

In the "Run" option in the start menu, enter "cmd" to open the cmd command window; enter Ping without parameters or ping /? to display Ping Command help:

Detailed explanation of commonly used ping commands

Detailed explanation of ping command:

-t: Ping the specified computer until interrupted.

-a : Resolve the address into a computer name.

-n count: Send the number of ECHO packets specified by count. The default value is 4.

-l size : Send an ECHO packet containing the amount of data specified by size. Default is 32 bytes; maximum value is 65,527.

-f : Send the "do not fragment" flag in the packet. The packet will not be fragmented by the gateway on the route.

-i ttl: Set the "Time to Live" field to the value specified by ttl.

-r count : Record the routes for outgoing and return packets in the "Record Route" field. count can specify a minimum of 1 and a maximum of 9 computers.

-s count :Specify the timestamp of the number of hops specified by count.

-j host-list: Route packets using the computer list specified by host-list. Contiguous computers can be separated by intermediate gateways (routing sparse sources) The maximum number of IPs allowed is 9.

-k host-list: Route packets using the computer list specified by host-list. Contiguous computers cannot be separated by intermediate gateways (Route Strict Source) The maximum number of IPs allowed is 9.

-w timeout: Specify the timeout interval in milliseconds.

destination-list: Specify the remote computer to ping.

The above is the detailed content of Detailed explanation of commonly used ping commands. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn