The functional explanation of Ping

Source: Internet
Author: User
Ping's role ping is a special term for submarines, a sonar pulse that responds, and Ping is a very useful TCP/IP tool in the network. Its main function is to detect network connectivity and analyze network speed.
Ping has a good side and a bad side. Let's talk about the good side first. It has been said that the purpose of ping is to detect the network together with the situation and analyze the network speed, but it is through what to show connectivity. This first takes a look at some of the ping's parameters and the return information.
Here are some of the parameters of the ping:
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
-T
Ping the specified computer until it is interrupted.
-A
Resolves the address to the computer name.
-N Count
Sends the number of ECHO packets specified by count. The default value is 4.
-L Length
Sends an ECHO packet that contains the amount of data specified by length. The default is 32 bytes; The maximum value is 65,527.
-F
Send no staging flags in the packet. The packet will not be segmented by the gateway on the route.
-I. TTL
Sets the live Time field to the value specified by the TTL.
-V TOS
Sets the service Type field to the value specified by TOS.
-R Count
Records the routing of outgoing and returned packets in the Record routing field. Count can specify at least 1 units, up to 9 computers.
-S Count
Specifies the timestamp of the metric specified by count.
-j computer-list
Routes packets using the list of computers specified by Computer-list. Continuous computers can be separated by intermediate gateways (routing sparse source) IP allows the maximum number of 9.
-K Computer-list
Routes packets using the list of computers specified by Computer-list. Continuous computers cannot be separated by intermediate gateways (strict source routing) the maximum number of IP allowed is 9.
-W Timeout
Specifies the time-out interval, in milliseconds.
Destination-list
Specifies the remote computer to ping.
Ping's return information has request Timed out, destination Net unreachable and bad IP addresses and source Quench received.

Request Timed out this information indicates that the other host can reach time out, this situation is usually for the other side refused to receive the packets you sent to it caused the packet loss. Most of the reason may be that the other side is equipped with firewalls or offline.
Destination Net Unreachable This information indicates that the other host does not exist or has not established a connection with the other. To illustrate the difference between destination host unreachable and time out, if the routing table of the routed router has a route to reach the destination, and the target is unreachable for other reasons, time will appear. If the routing table does not even have a route to reach the destination, the destination host unreachable appears.

Bad IP address This information indicates that you may not be connected to the DNS server so can not resolve this IP addresses, may be the IP address does not exist.
Source Quench received information is very special, it appears very little chance. It means that each other or halfway through the server is busy and unable to respond.
How to use the ping command to test network connectivity.
Connectivity problems are caused by a number of reasons, such as local configuration errors, remote host protocol failure, and of course, equipment and other failures.
First let's talk about the steps to use the ping command.
There are five steps to using ping to check connectivity:
1. Use Ipconfig/all to observe whether the local network settings are correct;
2. Ping 127.0.0.1,127.0.0.1 loopback address ping loopback address is to check the local TCP/IP protocol is not set up well;
3. Ping the native IP address, this is to check whether the IP address of this machine is set incorrectly;
4. Ping this network gateway or the IP address of this network, this is in order to check whether the hardware device has the problem, also can check this machine and local network connection is normal; (this step can be ignored in a non-LAN)
5. Ping remote IP address, this is mainly to check whether the network or the local and external connection is normal.
There may be errors in the process of checking network connectivity, which are generally divided into two most common types.
1. Request Timed out
Request time out this hint except that the other person mentioned in PING (a) may have a firewall or shutdown, and that the IP on this computer is incorrect and the gateway setting is wrong.
①, IP incorrect:
IP errors are mainly IP address settings or IP address conflicts, which can be checked using the Ipconfig/all command. IP conflicts under WIN2000 rarely occur because the system automatically detects if the same IP address is on the network and alerts you to the correct settings. In NT not only will appear request time out this prompt and will appear hardware error this hint information more special don't give it the hint of confused.
②, Gateway Setup Error: This error may occur in step fourth. Gateway setting error is mainly because the gateway address is not set correctly or the gateway does not help you forward the data, there is the possibility of remote gateway failure. This is primarily an error when you ping an external network address. The error is manifested in the inability to ping the external host to return information request timeout.
2. Destination Host Unreachable
When you start pinging a network computer, if a network device fails, the return message prompts destination host unreachable. The ping command generates this error if DHCP is used to assign IP to a local area network and a DHCP failure happens. Because the client cannot be assigned to an IP system when DHCP expires, it is often set to a different subnet for IP. So there will be destination Host unreachable. This error can also occur if the subnet mask is set incorrectly.
There is also a special is the route return error message, it generally will be destination host unreachable before the IP address to indicate which route can not reach the target host. This means your machine has no problem with the external network connection, but there is a problem connecting to a host.

Give me an example.
I manage a network of 19 computers, connected to the server by a 100M hub, and dynamically assigning IP addresses using DHCP.
One of my colleagues hurried to tell me that my outlook could not open, I went to his machine check, first I checked the local network settings, I use Ipconfig/all to see the IP distribution of all normal. Then I started to ping one of the machines in the network, and the first ping turned out to be normal, but outlook was still unable to use other network software and copy network files, but the network was slow, and the second ping I used a parameter-t (-t to ping each other without interrupting, I thought I would ping it once. found that there are time=30ms and request time out, ping this machine from the server is more interesting, request time out more than normal data, in the local area unexpectedly have time=30ms and request Time out is not normal. At first I think it is the problem of network card, but after the failure of the network card, redo the network cable still can not solve the problem, this fault is really interesting. In the end, I can't. put it on the other end of the hub port to switch to another port, ha. The fault is resolved. It turns out that the hub port is broken.
How to use the ping command to determine the speed of a link.
Ping this command in addition to check network connectivity and detect failures, there is a more interesting use, that is, you can use some of its return data to estimate the speed between you and a host of the number of bytes per second
Let's take a look at it for those return data.

Pinging 202.105.136.105 with bytes of data:

Reply from 202.105.136.105:bytes=32 time=590ms ttl=114
Reply from 202.105.136.105:bytes=32 time=590ms ttl=114
Reply from 202.105.136.105:bytes=32 time=590ms ttl=114
Reply from 202.105.136.105:bytes=32 time=601ms ttl=114

Ping statistics for 202.105.136.105:
Packets:sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trips times in Milli-seconds:
Minimum = 590ms, Maximum = 601ms, Average = 593ms

In the example, Bytes=32 represents 32 bytes of test data in the ICMP packet (which is the critical data for estimating the speed), and time=590ms is the round-trip time.

How to estimate the speed of the link. Give me an example. We set A and B as a PPP link.

From the ping example above you can note that the ICMP message sent by default is 32 bytes. In addition to these 32 bytes plus the 20-byte IP header and the 8-byte ICMP header, the total IP packet length is 60 bytes (since IP and ICMP are the primary use protocols of the ping command, the entire data message is added). Another protocol is used to transmit the ping command, which is the PPP protocol (Point-to-Point Protocol), so you add 8 bytes to the beginning and end of the data. During the transfer process, because each byte contains 8bit data, 1bit start bits, and 1bit end bits, the transfer rate is per byte 2.98ms. From this we can estimate the need for 405ms. That is, 68*2.98*2 (multiply 2 because we also want to calculate its round-trip time).

Let's test the 33600 b/S Link:

Pinging 202.105.36.125 with bytes of data:

Reply from 202.105.36.125:bytes=32 time=415ms ttl=114
Reply from 202.105.36.125:bytes=32 time=415ms ttl=114
Reply from 202.105.36.125:bytes=32 time=415ms ttl=114
Reply from 202.105.36.125:bytes=32 time=421ms ttl=114

Ping statistics for 202.105.36.125:
Packets:sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trips times in Milli-seconds:
Minimum = 415ms, Maximum = 421ms, Average = 417ms

See if it's about the same. ^_^

You may notice here that the estimate is in error with the actual value. Because we are now estimating a theoretical value, there are some things we do not consider. such as other disturbances in the network, the main interference to the other computers. Because it is not practical to stop all computers from using the network to test you when you test. The other is the transmission equipment, because there are some devices such as the modem it will transfer data

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.