"Ping" command is used in determining the order of a network failure, but you really understand this command to run what will happen, and there's all kinds of information show anything? Actually skilled master Ping command of a variety of techniques can help you solve many network problems. Here we come to a detailed look at Ping command.
"Ping" behind the process
We are a network with the following example: There are A, B, C, D four machines in a routing RA, subnet mask were 255.255.255.0, the default route to 192.168.0.1
1. In the same network segment
A host running "Ping 192.168.0.5" After what happened then? First of all, Ping command will build a fixed format of the ICMP request packet, then the ICMP protocol to the packet with the address "192.168.0.5" together to the IP layer protocol (and, like ICMP, is actually a set of processes running in the background), IP layer protocol will address "192.168.0.5" as the destination address, the machine IP address as source address, together with some other control information for a IP data packet, and try to be 192.168.0.5 the MAC address (physical address, which is building the data link layer data link layer transmission unit - frame necessary) to give data Construction of a data link layer frame. The key here, IP layer protocol through the machine B's IP address and its subnet mask, found that it is the same with its network of directly in the network to find the machine's MAC, if the previous two planes had communication in the ARP cache table A machine B machine should have its MAC IP mapping, and if not, to send a broadcast ARP request to obtain B machine MAC, be given to the data link layer. The latter builds a data frame, the destination address is the IP layer pass over the physical address, source address is the physical address of the machine, but also add some control information, based on the Ethernet media access rules, send them out.
Host B receives this data frame, the first check its destination address, and the physical address and native contrast, if found, then the receiver; otherwise discarded. After checking the received data frame, the IP packet extracted from the frame, to the machine's IP layer protocol. Similarly, IP layer inspection, after the extraction of useful information to the ICMP protocol, the latter treatment, immediately build a ICMP reply packet is sent to the host A, the process and send the ICMP request packets the host A to host B exactly the same.
2. Not on the same network segment
A host running "Ping 192.168.1.4", began with the above, as to how to get MAC address, IP protocol is found through the D machine and its not in the same network segment, it will be handed over directly to the routing address, that is, take over the routing of the MAC, as to how to get the routing of MAC, as with the above, the first in the ARP cache table to find, can not find it on the radio. After routing to get this data frame, and talking to the host D contact, if not found, it returns a timeout to host A's information.
Return information on the analysis of Ping
1.Request timed out
This is a reminder we often meet many of the other articles say that this is the machine set a filter ICMP packets, working from the above process, this is not entirely correct, at least under some circumstances.
Figure: return information on the analysis of Ping
(1) the other has been turned off, or the network did not have the address: for example, host A in the diagram above in PING 192.168.0.7, or shutdown the host B, host A, PING 192.168.0.5 will get the information out.
(2) the other party and its not in the same network segment, can not find each other through the route, but sometimes the other does exist, of course, there is no time-out information is returned.
(3) the existence of each other, but to set the ICMP packet filtering (such as firewall settings).
How do you know each other exist, or it does not exist, you can use with parameter-a of the Ping command detection of each other, if we can get the other side of the NETBIOS name, it indicates the existence of the other side, there is a firewall settings, if not, most they do not exist or is shut down, or not in the same network segment.
(4) set the IP address error
Under normal circumstances, a host should have a network card, an IP address, or multiple cards, multiple IP addresses (the address must be in different IP subnets). However, if a computer's "dial-up adapter" (the equivalent of a soft card) and TCP / IP settings, set up a network card IP address in the same subnet IP address, so that appears in the IP layer protocol, this host there are two different interfaces in the same network segment. When this host Ping other machines when there is the question:
A. host does not know what the data packets sent to network interface, because there are two network interfaces are connected to the same network segment.
B. host does not know which address as the source address of the packet. Therefore, from host to Ping other machines, IP layer protocol will be unable to process after the overtime, Ping will give a "no answer timeout" error message prompts. However, other host Ping this host, the request packets from a specific network card, ICMP just simply end, the source address of exchange, and can change some signs, ICMP response packet can be issued to the other hosts are able to Ping the machine successfully pass a.
2.Destination host Unreachable
(1) each other and their not in the same network segment, which itself had not set the default route, such as the above example A machine does not set the default route, run the Ping 192.168.0.1.4 will appear "Destination host Unreachable" .
(2) network cable out of trouble
Here to explain "destination host unreachable" and "time out" the difference, if the router's routing table after the routing has to reach a goal, the target can not be reached for other reasons, which occur when "time out", if routing table with the route did not reach the target, then there will be "destination host unreachable".
3.Bad IP address
The information that you may not connect to the DNS server, it can not resolve this IP address may be IP address does not exist.
4.Source quench received
This information is rather special, it appears very little chance. It said that the other party or the way the server busy unable to respond.
5.Unknown host - unknown host
This error message means that the remote host's name can not be domain name server (DNS) into IP addresses. Domain name server failure may be due to a fault, or his name is not correct, or the network administrator of the system and lines of communication between the remote host has failed.
6.No answer - no response
This failure shows the local system has a host of routes leading to center, but not receive it on to host the Centre any information. Failure may be due to one of the following: center console does not work; local or central host network configuration is incorrect; local or central router does not work; communication line has failed; center console routing problems exist.
7.Ping 127.0.0.1:127.0.0.1 the local loop address
If the address can not Ping, then when that local machine TCP / IP protocol does not work.
8.no rout to host: network card not working properly
9.transmit failed, error code: 10043 network card driver is not normal
10.unknown host name: DNS is configured incorrectly
These are my "spell" (Ping) in the process, get some experience, skills and hope it'll work and study help.