Getting Started with the ping command

Source: Internet
Author: User
Tags error code domain name server firewall

1, the basic knowledge of ping

The ping command believes that we are all familiar with but it is not a lot of people who can play the role of Ping, of course, I am not saying that I can let ping play the most functions, I just often use ping this tool, but also summed up some small experience, and now share with you.

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 is about some of the parameters and the return information of the ping.

2, Ping Order detailed

First need to open the DOS command interface, by clicking on the Start Menu "Run" option, enter "CMD", return can be opened (as shown below).

After carriage

We enter ping/? Examples of ping below are some of the parameters of ping (figure):

Let me explain to you the meaning and use of each parameter.

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 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 sends a "do not fragment" flag in a packet. The packet will not be segmented by the gateway on the route.

The-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 route 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 uses the computer list specified by computer-list to route packets. 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 computer list 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.

3, how to use ping this 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 the local network settings are correct, as shown;

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.

4, how to use ping command to judge a link good or bad?

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.

In the example "bytes=32" indicates that there are 32 bytes of test data in the ICMP packet, and "Time=4ms" is the round-trip time. Sent sent multiple seconds packets, Received received multiple response packets, Lost dropped how many minmum minimum, maximun maximum, Average average. On the diagram, it only takes 4MS time to go back and forth, the lost =0 is 0 and the network status is quite good. (You can ping 100 times with the-n argument "Ping–n IP address" in more detail.) View changes to these values for Sent Received Lost minmum maximun Average. )

5, the analysis of the return information after the ping

1.Request timed out

This is often encountered by the message, many articles that this is the other machine to filter the ICMP packets, from the above work process, this is not completely correct, at least in the next few cases.

(1) The other side has shut down, or the network does not have this address at all: for example, in the above figure in host a ping 192.168.0.7, or Host B shutdown, in host a ping 192.168.0.5 will get timeout information.

(2) The other side is not in the same network segment, through routing can not find each other, but sometimes the other side does exist, of course, does not exist is also return timeout information.

(3) The other does exist, but ICMP packet filtering is set up (for example, firewall settings).

How to know that each other is present, still does not exist, you can use the ping command with a parameter-A to detect each other, if you can get the other's NetBIOS name, then the other side is there, there is a firewall set up, if not, most of them do not exist or shutdown, or not in the same network segment.

(4) Error setting IP address

Under normal circumstances, a host should have a network card, an IP address, or multiple network cards, multiple IP addresses (these addresses must be in a different IP subnet). However, if a computer has a dial-up networking adapter (equivalent to a soft card) in TCP/IP settings, set a network card IP address on the same subnet IP address, so that, in the IP layer protocol, this host has two different interfaces in the same network segment. This problem occurs when you ping another machine from this host:

A. The host does not know which network interface The packet is being sent to, because there are two network interfaces connected to the same network segment.

B. The host does not know which address to use as the source address of the packet. Therefore, from this host to Ping other machines, the IP layer protocol can not be processed, after the timeout, the ping will give a "timeout no answer" error message prompt. However, ping this host from other hosts, the request package from a specific network card, ICMP only need to simply convert the destination, the source address, and change some flags, ICMP answer packets can be successfully issued, other hosts will be able to successfully ping this machine.

2.Destination Host Unreachable

(1) The other side is not in the same network segment, and they have not set the default route, such as in the example in a machine does not set the default route, run Ping 192.168.0.1.4 will appear "destination host unreachable."

(2) network cable out of trouble

Here is a description of the difference between "destination host unreachable" and "Time Out", and if the routing table of the routed router has a route to reach the destination, and the target is unreachable for other reasons, then "Time Out" appears. If the routing table does not even have a route to reach the destination, then "destination host unreachable" appears. 3.Bad IP Address

This information indicates that you may not be connected to the DNS server, so this IP address cannot be resolved, or the IP address may not exist.

4.Source Quench received

This information is very special, and it appears in a very low probability. It means that each other or halfway through the server is busy and unable to respond.

5.Unknown host--Unknown Host

This error message means that the name of the remote host cannot be converted to an IP address by the domain name server (DNS). The cause of the failure may be a failure of the domain name server, or incorrect name, or a faulty communication line between the network administrator's system and the remote host.

6.No answer--No response

This failure indicates that the local system has a route to the central host, but does not receive any information it sends to the central host. The reason for the failure may be one of the following: The hub host is not working, the local or central host network is improperly configured, the local or central router is not working, the communication line is faulty, and the hub host has a routing problem.

7.Ping 127.0.0.1:127.0.0.1 is a local cyclic address

If this address is not ping, the local machine TCP/IP protocol does not function.

8.no rout to host: NIC is not working properly.

9.transmit failed,error code:10043 NIC driver is not normal.

10.unknown host Name:dns is not configured correctly.

The above is I in the "Fight" (Ping) process, summed up some of the experience of skills, I hope to be able to work and learning to help.

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.