Use of the ping command

Source: Internet
Author: User

How the ping command works:

The principle of ping is to establish the channel first, and then send the packet, the other received after the return of information, the package at least include the following content, when sent, the contents of the package includes each other's IP address and its own address, as well as sequence number, back to the time including both sides address, there The main is that the receiver is in the operating system of the kernel, at all times in the listening, provide a section of C program code. Network machines have a unique IP address, we send a packet to the destination IP address, the other side will return a packet of the same size, according to the returned packets we can determine the existence of the target host, you can initially determine the target host's operating system.

For example, you ping the site, with this can check network connectivity, you can see the IP address, here in the "Ping www.xue51.com" to execute the ping command to see whether the site is together with the server, whether the normal open. If it is ping the other web site will send a request information, the other side back, calculate the delay. But now many servers are ping-proof. As shown in the figure:

How do I get into and use the ping command?

Click on the Desktop Start menu, click on the "Start menu" above the "Run" program, and then run the input box to enter the cmd command, execute this command to open a command prompt window. And then enter the ping/? Example ping below is some of the ping's parameters. As shown in the figure:

-T Ping the specified host until it stops. For example, your non-stop to the target IP low go send packets, in the other data packets can not bear so much data will be due to the network anomaly and drop the line, which will cause the site can not open and network connectivity failure.

-a resolves the address into a host name

-N Count the number of ECHO requests to send, the default value is 4.

-L size default to send buffer size defaults to 3 times. If the network speed is slow, 3 times for us also wasted a lot of time, because now our goal is only to determine whether the target IP exists, then define it as once.

-F Setting the "Do Not Fragment" flag (for IPV4) packets in the packet will not be segmented by the gateway on the route.

-I TTL survival time

-V TOS Service type (for IPv4. This setting is not approved for use and has no effect on the service field type in the IP header).

-R Count records the route to compute a hop (for IPv4)

-S count Count Hop Timestamp (applies to IPv4)

-j host-list a loose source route with a host list (for IPV4)

-K host-list Strict source routing with host List (for IPV4)

-W timeout timeout for each reply (in milliseconds)

-R also uses routing headers to test reverse routing (for IPV6)

-S srcaddr the source address to use

-4 mandatory use of IPV4

-6 mandatory use of IPV6

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. )

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.