The ping command of a Linux system is a commonly used network command that is typically used to test connectivity to the target host by sending ICMP echo_request packets to the network host (send ICMP echo_request to net hosts) and displaying So that we can determine whether the target host is reachable (but this is not absolute) based on the information it outputs. Some servers are security-enabled to set up firewalls that prohibit pings or disable pings in kernel parameters to avoid being detected by outsiders.
There is a slight difference between the ping under Linux and the ping under Windows, the Linux ping does not automatically terminate, you need to press CTRL + C to terminate or use the parameter-C to specify the number of responses required to complete.
1. Command format:
ping [parameters] [host name or IP address]
2. Command function:
The ping command is used to determine the status of the network and the external hosts, track various hardware and software issues, and test, evaluate, and manage the network. If the host is running and connected to the network, it responds to the loopback signal. Each echo request consists of an Internet Protocol (IP) and (ICMP) header, followed by a Tim structure, and sufficient bytes to fill in the packet. The default is to send the loopback signal request continuously until the terminal signal (CTRL + C) is received.
The ping command sends a datagram every second and prints a line of output for each response received. The ping command calculates the statistics of the signal round-trip time and (information) packet loss, and displays a brief summary after completion. The ping command ends when the program times out or when a SIGINT signal is received. The host parameter is either a valid host name or an Internet address.
3. Command parameters:
-D using the So_debug feature of the socket
-F limit detection, mass and fast send network packets to a machine to see its response. Ping of----death
-n outputs only numeric values
-Q does not display information for any transmittal packets, only the final results are displayed
-R ignores the normal Routing Table and sends the packet directly to the remote host. This is usually a matter of looking at the network interface of this computer.
-R Record Routing process
-v verbose display of instruction execution process
Number of <p>-c: Stop after sending a specified number of packages
-I seconds: set interval a few seconds to send a network packet to a machine, the default value is one second to send once.
-I network interface: send out packets using the specified network interface
-L Pre-load: Sets the packets that are emitted before the requested information is sent
-P template style: Set the template style to fill the packet
-S Bytes: Specifies the number of bytes sent, the default value is 56, plus 8 bytes of ICMP header, which is a total of 64 bytes of ICMP data
-T Survival value: Sets the size of the Live value TTL
4. Usage examples:
Instance 1:ping specified number of times
Command: ping-c 10 192.168.1.1
Example 2: Set ping for time interval and number of times limit
Command: ping-c 10-i 0.5 192.168.1.1
Example 3: Multi-parameter combination use
Command:
Ping-i 3-s 1024-t 255 192.168.1.1
Note:-I 3 send period is 3 seconds (time can be 0, but not negative),-s set the size of the sending packet is 1024 (maximum 65507),-T setting TTL value is 255
In addition, the limit test of the-f parameter, it is the speed of the contract than the-I 0 is also faster, I 0.0000000000000000001 speed is close to-I 0.
One Linux command per day (--ping) command