SoFunction
Updated on 2025-04-10

Detailed explanation of Ping commands, streamlined and practical

Ping is a very frequently used utility to determine whether a local host can exchange (send and receive) datagrams with another host. Based on the returned information, we can infer whether the TCP/IP parameters are set correctly and whether they are running normally. It should be noted that successful datagram exchange with another host does not mean that the TCP/IP configuration is correct. We must perform a large number of datagram exchanges between local hosts and remote hosts in order to be sure of the correctness of TCP/IP.

Simply put, Ping is a test program. If Ping is run correctly, we can roughly eliminate faults in the network access layer, network card, MODEM input and output lines, cables and routers, etc., thereby reducing the scope of the problem. However, because the size of the sent datagrams can be customized and the endless high-speed transmission, Ping is also used as a tool for DDOS (denial of service attack) by some people with ulterior motives. For example, many large websites are paralyzed by hackers using hundreds of computers that can access the Internet at high speed to continuously send large amounts of Ping datagrams.

According to the default settings, the Ping command running on Windows sends 4 ICMP (Internet Control Message Protocol) loopback requests, each with 32 bytes of data. If everything is normal, we should get 4 loopback responses. Ping can display the amount of time between sending a loopback request and returning a loopback response in milliseconds. If the response time is short, it means that the datagram does not have to go through too many routers or network connections faster. Ping can also display the TTL (Time To Live time) value. We can calculate how many routers the packet has passed through through the TTL value: the source location TTL start value (that is a 2-square multiplied by a slightly larger than the return TTL) - the TTL value when returning. For example, if the TTL value is 119, then it can be estimated that the TTL starting value of the datagram leaving the source address is 128, and the source location to the target location must pass through 9 router network segments (128-119); if the TTL value is 246, the TTL starting value is 256, and the source location to the target location must pass through 9 router network segments.

1. Typical order of detection of network failures through ping

Under normal circumstances, when we use the Ping command to find the problem or verify the network operation, we need to use many Ping commands. If all are run correctly, we can believe that there is no problem with the basic connectivity and configuration parameters; if some Ping commands run failure, it can also indicate where to find the problem. Here is a typical detection order and corresponding possible faults:

·ping 127.0.0.1
This Ping command is sent to the local computer's IP software, and the command never exits the computer. If this is not done, it means that there are some basic problems in the installation or operation of TCP/IP.

·ping native IP
This command is sent to the IP address configured by our computer, and our computer should always respond to the Ping command. If not, it means there is a problem with the local configuration or installation. When this problem occurs, LAN users disconnect the network cable and resend the command. If this command is correct after the network cable is disconnected, it means that another computer may have the same IP address configured.

·ping Other IPs in the LAN
This command should leave our computer, go to other computers through the network card and network cable, and then return. Receiving a reply to the reply indicates that the network card and carrier in the local network are operating correctly. However, if 0 replies are received, it means that the subnet mask (code that separates the network part of the IP address from the host part when subnet splitting) is incorrect, or the network card configuration is incorrect or there is a problem with the cable system.

·ping gateway IP
If this command is answered correctly, it means that the gateway router in the LAN is running and can respond.

·ping Remote IP
If 4 replies are received, it means that the default gateway has been successfully used. For dial-up users, it means that they can access the Internet successfully (but it is not ruled out that there will be problems with the DNS of the ISP).

·ping localhost
localhost is a system-based network name, it is an alias for 127.0.0.1, and every computer should be able to convert the name to this address. If this area is not done, it means there is a problem in the host file (/Windows/host).

·ping (such as Tianji.com)
Ping address for this domain name is usually through the DNS server. If a failure occurs here, it means that the IP address of the DNS server is not configured correctly or the DNS server is faulty (for dial-up users, some ISPs no longer need to set up a DNS server). By the way: We can also use this command to implement the domain name conversion function to IP address.

If all the Ping commands listed above work properly, we can basically feel at ease about the local and remote communication function of our computers. However, the success of these commands does not mean that all of our network configurations are fine, for example, some subnet mask errors may not be detected by these methods.

2. Common parameter options for Ping commands

·ping IP –t
Continuously execute Ping commands on the IP address until the user interrupts with Ctrl+C.

·ping IP -l 3000
Specifies that the data length in the Ping command is 3000 bytes, instead of the default 32 bytes.

·ping IP –n
Execute a Ping command for a specific number of times.