Contacts

How to interrupt ping on the command line. Command Line: Basic teams. Syntax Parameters Important Ping Command Keys

To Omand Ping sends data packets to a specific IP address on the network, and then makes it possible to find out how much time it took to transmit these data and receive a response. This is a convenient tool that you can use to quickly test various points of your network. That's how to use it.

How Ping Works

Ping comes from the term used in Sonar technology, which sends sound pulses, and then listens to the return of echo. IN computer network Ping tool is built into most operating systemsthat work almost the same way. You give the Ping command along with a specific URL or IP address. Your computer sends several information packages to it, and then waiting for an answer. When he receives an answer, the Ping tool shows you how much time each package has spent to make this journey, or reports that there was no answer.

It sounds simple, and it is. You can check if your computer can connect to another device - for example, your router - in local network or to the device on the Internet. It can help you determine if there is network problem Somewhere in your local network or somewhere else. The time required to return packets can help you determine the slow connection or if you encountered packet loss.

And it does not matter which operating system you use. Raise the terminal or the command line window, and you can use Ping for MacOS, Linux or any version of Windows.

How to use Ping.

We are going to use command line Windows in our example here. But yes you can also use the Ping command in Windows PowerShell or in the Terminal application on MacOS or any distribution Linux. As soon as the days get to the actual team, it works equally everywhere.

In Windows, press Windows + R. In the Startup window, enter "CMD" in the search field and click "Enter".

In the command prompt, enter "Ping" with the URL or IP address you want to check, and press "ENTER" ..

This response shows the URL that you view, the IP address associated with this URL and the size of the packages sent in the first row. The following four lines show the answers from each individual package, including the time (in milliseconds), which is required for the response, and the lifetime (TTL) of the packet, which is the amount of time that must pass to the package reset.

Below, you will see a summary that shows how many packets have been sent and obtained, as well as the minimum, maximum and average response time.

And in the following figure we ping the router in our local network using its IP address. We also get a normal answer from it.

When the Ping tool does not receive a response from any devices that you ping, it also gives you to know about it.

And so how to use ping at the most basic level. Of course, like most teams, there are several additional options that you can use to make it behave differently. For example, you can make it track your destination until you stop the command, you will not specify how many times you want it to perform Ping, asked how often he must ping, and much more. But if you do not fulfill some specific troubleshooting types, you do not need to worry about these extended parameters.

If you are interested, just enter "Ping /?" In the command prompt to see the list of parameters.

What can you do with ping

Now that you know how to use this team, here are some interesting things you can do with it:

  • Ping URL (for example, site) or IP address to find out whether you can get to the Internet addressee. If you get a successful answer, you know that all network devices between you and this recipient work, including network adapter On your computer, your router and any internet devices between your router and destination. And if you are interested in further studying these routes, you can use another network tool With the name Tracert to do it.
  • Ping URL to see his IP address. If you want to find out the IP address for a specific URL, you can send the URL. Ping tool Shows you at the top of the IP address with which it works.
  • Ping your router to see if you can achieve it. If you can not successfully perform Ping Internet addresses, you can try to perform a ping connection with your router. A successful answer allows you to find out that your local network is working fine, and the problem associated with access to the Internet site is somewhere outside your control.
  • Ping your LOOPBACK address (127.0.0.1). If you can't successfully perform Ping Router, but your router seems to be enabled and running, you can try Ping the so-called LOOPBACK addresses. This address is always 127.0.0.1, and its successful testing allows you to find out that the network adapter on your computer (and network software in your OS) works correctly.

Note: You cannot get an answer ping from other computers on the local network, because the built-in firewalls on these devices do not allow them to respond to Ping queries. If you want to be able to ping these devices, you need to disable this setting to allow passage through the firewall.

In the above list, an external approach is used when you first send a request to the most remote destination, and then pave the path to more local devices. Some people like to work on the contrary, first ping the loopback addresses, then the router (or another local device), and then the Internet address.

And, of course, what we are talking about in this article mainly refers to using Ping to troubleshoot the home or small business network. In addition, if you are charged with troubleshooting in large networks, you probably already know how to use ping and many other network tools.

Team Ping. This is perhaps the most used network command line utility. Ping. Present in all versions of all operating systems with network support and is a simple and convenient tool for a node polling name or its IP address.

For the exchange of service and diagnostic information on the network uses a special protocol of managers. Icmp Internet Control Message Protocol). Team Ping. Allows you to send a type of control message type Echo Request. (Type is 8 and is specified in the ICMP message header) Addressable node and interpret the response received from it in a form convenient for analysis. In the data field of the ICMP package, the English alphabet symbols are usually contained. In response to such a request, the interviewed node is reasonable to send an ICMP package with the same data that was accepted and the message type Echo Reply (type code in ICMP header is 0). If any problem occurs when exchanging ICMP messages, the Ping utility will display information for its diagnostics.

Command line format:

Ping [-t] [-A] [-n Number] [-l Size] [-f] [-i TTL] [-V TOS] [-R Number] [-S Number] [[-J ListHail] | [-K list logs]] [-w Timeout] finite

Parameters:

-t. - Continuous segment of packages. Combinations of keys are used to complete and output statistics. Ctrl + Break (statistics and continuation), and Ctrl + C. (output statistics and completion).
-a. - Defining addresses by nodes.
-N Number - The number of sent echo requests.
-l Size - Data field size in the bytes of the sent request.
-f. - Installing the flag prohibiting package fragmentation.
-i TTL. - Set the lifetime of the package (field "Time to Live").
-V TOS. - Task type type (field "Type of Service").
-R Number - Record the route for the specified number of transitions.
-s Number - time stamp for the specified number of transitions.
-J listware - free choice of route by list of nodes.
-K list logs - Hard route selection by list of nodes.
-W Taimout - The maximum waiting time of each response in milliseconds.

Examples of using:

ping Google.com. - Echo request to the node named google.com. With default parameters - the number of packages is 4, the length of the data array \u003d 32 bytes.

ping -6 ya.ru. - Ping node ya.ru. using IPv6 protocol

ping -a 192.168.1.50 - Perform ping with the definition of the name of the end site at its address.

ping -S 192.168.0.1 Computer - Ping node computer From the source 192.168.0.1. Used when there are multiple network interfaces on the computer.

ping W 5000 ya.ru - Ping with wait timeout is 5 seconds (by default - 4 seconds).

ping -N 5000 -L 1000 site - Survey node website 5000 times, packages with a length of 1000Bet. Permissible maximum length data - 65500.

ping -N 1 -L 3000 -f ya.ru - Ping with a ban fragmentation package.

ping -n 1-R 3 ya.ru - Send 1 Echo request to the node ya.ru. With the display of the first 3 transitions on the route.

ping -i 5 ya.ru - Ping indicating the time of life TTL \u003d 5. If you need to achieve the end node large quantity Transitions along the route, the router that interrupted the delivery will respond with the message "Life life (TTL) is exceeded when transferring a package."

  • Ping application for step-by-step diagnostics of Internet access problems:
  • Generalized Computer Connection Scheme (Tablet, Laptop home network) The remote end node can be represented as follows:

    The most common network with IP addresses is used as a home network 192.168.1.0 /2555.255.255.0. We are talking About IPv4 - IP Protocol version 4, where 4 bytes are used to address. IP addresses It is customary to submit in the form of decimal values \u200b\u200bof bytes separated by points. Each device on the network must have a unique address. In addition to the address, in the network settings used mask Networks (subnet mask). The mask has the same submission format, as well as the address. The combination of addresses and masks determines the range of addresses that belong to the LAN - 192.168.1.0-192.168.1.255. The first and last range of the range are not assigned to individual network devices, since they are used as a network address and broadcast address. Usually, the address of the router is made equal to 192.168.1.1 or 192.168.1.254. This is not a mandatory standard, but in practice it is used quite often. Single mask bits define a permanent part of the IP address of the network, and zero-allocated by individual nodes. Value 255 - This is a byte with united bits. The network mask serves as a means of determining the range of IP addresses belonging to the local network. Devices with such addresses are attainable locally, without using routing. Routing is a method for exchanging data with network devices not belonging to this local network through a special device - router (Router, router). Routers are specialized computers with multiple network interfaces and specialized software Supporting IP packets between the sender and the recipient located in different networks. In such a shipment, several routers can participate, depending on the complexity of the route. The home router is the simplest variation of the router, which provides shipment of packets addressed to the external networks next route router on the provider's network. The following router checks the achievability of the address of the destination node locally, and either forward data or transfers them to the next router in accordance with the route table. This happens until the data is reached by the recipient or end the lifetime of the package.

    The Ping command can be used to diagnose individual nodes:

    ping 127.0.0.1 - This is ping a loop interface. Must be performed without errors, if installed and are in working condition Network software components.

    ping your IP or name - Ping on own address or name. Must end without errors, if all IP protocol software is installed and a network adapter is in charge.

    ping Router IP Address - must be executed if working lAN card Computer, Fixed Cable or Wireless Connection, used to connect to the router and Figure Router itself. In addition, IP settings must be such that the address of the computer and the router belong to one subnet. Usually it is when network settings Performed automatically by means of the DHCP server of the router.

    ping Yandex.ru. - Perform a node survey named yandex.ru.. If the survey is completed with the error, the reason may be not only the lack of communication with the provider router, but also the impossibility of determining the address of the node yandex.ru. due to problems with software Name resolution.

    ping 8.8.8.8. - Perform a node survey with an IP address of 8.8.8.8. If the survey is performed at the address without errors, and the name of the name is completed by the message about an unknown node, the problem is in the resolution of names. The reason may be the inoperability of the DNS server provider. In this case, you can try to change it in the settings network connection on public DNS Server Google with addresses 8.8.4.4 and 8.8.8.8. Also, the problem may be caused by poor quality of communication with the provider, which is accompanied by too much response time and packet disappearance.

    ping -t Yandex.ru. - Perform ping before pressing the Ctrl + C combination, when you click Ctrl + Break - statistics and the node survey continues.

    Ping -N 1000 -L 500 192.168.1.1 - Run Ping 1000 times using messages, 500 bytes long. Ping packages of standard length in 32 bytes can be performed without errors, and on long - with errors, which is typical for wireless connections With a low signal level under intense interference conditions.

    Ping -N 1 -R 9 -W 1000 Yandex.ru - Run Ping 1 time (key -N 1), extradite the route for the first 9 transitions (-R 9), expect a response to 1 second (1000 ms)

    As a result of the execution of this command, a route tracing is displayed:

    Batch exchange with Yandex.ru with 32 data bytes:
    Answer from 87.250.251.11: Number byte \u003d 32 Time \u003d 36ms TTL \u003d 54
    Route: 81.56.118.62 -\u003e
    81.56.112.1 ->
    10.109.11.9 ->
    10.109.11.10 ->
    195.34.59.105 ->
    195.34.52.213 ->
    195.34.49.121 ->
    195.34.52.213 ->
    87.250.239.23

    Ping statistics for 87.250.251.11:

    Packages: Posted \u003d 1, Received \u003d 1, Lost \u003d 0
    (0% loss)
    Approximate reception time in MS:
    Minimum \u003d 36 ms, maximum \u003d 36 ms, mean \u003d 36 ms

    IN this exampleThe chain of 9 routers is built between the sender and recipient of the packages. Need to take into account the fact that in the utility version ping.exe. For Windows, the number of transitions can receive a value from 1 to 9. In cases where this value is not enough, a command is used. tracert.

    The absence of an echo response is not always a sign of a malfunction, because sometimes for security reasons, some nodes are configured to ignore echo requests sent ping. An example is the node microsoft.com. And some routers in small providers networks.

    Use Ping in command files.

    Often, the Ping command is used to organize delays in command files. Pencing a loop interface is performed with the desired value of the packet counter specified by the parameter -N.. The sending of echo requests is performed with an interval of 1 second, and the response on the loop interface comes almost instantly, so the delay will be approximately equal to the counter minus one:

    ping -n 11 127.0.0.1 - Delay in 10 seconds.

    The Ping command is used in command files to determine the availability of IP addresses. Since, the result of the polling is not reflected in the ErrorLevel variable, then instead of its analysis uses the search for certain features in the standard Ping output data. If you carefully look at the Ping.exe program messages when a survey of an affordable and inaccessible node is surveyed, we can see that they differ significantly

    ping 456.0.0.1 - Ping on a non-existent address

    The answer to such a command may differ from the specific version of the utility, and may be approximately

    When checking the connection, it was not possible to detect the node 456.0.0.1. Check the node name and try again.

    ping Yandex.ru. - Ping to the address of the yandex.ru node

    Reply to Ping Available node:

    Exchange packages with yandex.ru 32 bytes:
    Answer from 87.250.250.11: Number byte \u003d 32 Time \u003d 10 ms TTL \u003d 55

    Thus, to solve the task of determining the availability of the node in the command file, it is sufficient to analyze the characteristic words in the pen.exe output with a successful answer. Most characteristic in this case the presence of a word TTL.. It never occurs when an error occurs and consists of just from the symbols of the English alphabet. To search for "TTL" in the results of Ping.exe it is convenient to combine it to execute it in a chain with a symbol string search command Find.exe. (Ping and Find Conveyor). If the text is found by the Find command, the value of the ErrorLevel variable will be equal to 0

    Ping -n 1 Computer | Find / I "TTL"\u003e NUL
    IF% errorlevel% \u003d\u003d 0 Goto Live
    Echo Computer is unavailable
    Subprogram processing of an inaccessible state
    ...
    EXIT
    : Live - Start a node availability processing routine
    ...
    ...

    In more simple version You can use commands:

    Ping Yandex.ru | Find "TTL \u003d" && ECHO YANDEX PINGABLE - The ECHO command is performed if the errorlevel value set by the Find is 0, i.e. node yandex.ru. Replies to Ping.

    Ping Server64 | Find "TTL \u003d" || Echo Server64 Not Pingable - The ECHO command is executed if the errorlevel value installed Find is not equal to 0, i.e. knot Server64. did not answer Ping.

    Team line Windowsis usually not used by most users, perhaps because not everyone knows which teams need to be used in one case, what useful it can sometimes be, or at all - what is it?

    If you are one of these users, I hope this article will help you start using it. Perhaps you just have forgot some team, and here I hope to help you.

    At first glance, RJ may seem boring, difficult or useless tool, but I assure you, it is not!

    This article is intended exclusively as an introduction to some of the many useful commands.

    Basic CMD commands.

    1. Forced stop running process Ctrl + C.

    The first command you should know this simultaneous pressing two Ctrl and C keys. This combination stops almost any team. If you have found an error in the entered command, you can simply erase unnecessary characters using the Backspace button, but if you have already launched something that needed, you can use a Ctrl + C combination.

    Attention! This team is not a magic wand! It will not be able to cancel those processes that cannot be canceled, so be careful!

    2. Calling a team help /?

    The second command you should remember is /? . By typing these two characters after another command, you will see a certificate for the team you are interested in. For example:

    3. Information about your network connection

    This command displays information about your local network connection:

    More full information You can find out about your computer by typing command.

    4. Ping Checking (Connection Check) Ping

    Suppose you are connected two computers by Ethernet cable (how to enable the cable to create a local network, we have already considered earlier). You need to be sure that there is a connection between them. To do this, you need from a computer whose IP address 192.168.0.1 Run Ping 192.168.0.5 (where 192.168.0.5 is the IP address of the second computer).

    If everything is in order, then pinggi will appear before you. If something is not done so, you will have the inscription specified node is not available. Stop this command you can with Ctrl + C.

    5. Exit from the EXIT command prompt.

    The Exit command you can close the command line window.

    6. Copy XCOPY files.

    Highly useful tool To copy files. Suppose you want to copy photos from the C disk to an external disk.

    Dial xcopy C: Photo F: Photo / S / E (where f is an external disk).

    6. Time check time.

    If you need to configure, printing TIME, you will be presented current Time. And here you will be offered to change the time to the right one.

    7. Open the new CMD or Start command line window.

    Enter the CMD or START command and the new command line window opens. You can also simply clear the acting window. To do this, type the CLS command (Clear Screen).

    8. Check system files SFC / SCANNOW.

    Malicious software sometimes tries to replace the system kernel files with modified versions in order to gain control over the system. Checking system files can be used to check the integrity of the files windows systems. If any files are damaged or remote, then they will be replaced.

    9. Information about installed drivers DRIVERQUERY.

    If you want to see which drivers are installed on your PC, you can do it by running the DriverQuery command. This command provides information about each driver that you use.

    If you need a little more informationYou can add the Latin letter V (here, how it will look like DRIVERQUERY-V).

    10. Find out the IP address of the site NSLOOKUP SITE.RU

    Dial on the command line NSLookup Website.ru to find out the IP address of the site site.ru.

    11. Insert text

    In order to insert the text on the command line you need, as usual, copy it from the source, and then just click Once right mouse in the Black Screen area.

    The Ping command is used to make sure that the computer can interact with the network and resources inside it. Ping works at the expense of Echo Request messages on the ICMP protocol ( Internet Control Message Protocol) And the awaiting answer. It makes it possible to find out how many answers are received, and how much time it passed:

    Ping command syntax

    ping [-T] [-A] [-N Count] [-l Size] [-f] [-i TTL] [-V TOS] [-R Count] [-s count] [-W TimeOut] [- R] [-s srcaddr] [-p] [-4] [-6] target

    T \u003d This option will ping a target device until you are forcibly stopping the CTRL + C key combination.

    A \u003d Requests the host name by the target IP address.

    N Number \u003d Sets the number of ICMP messages to be sent. If you execute the Ping command without specifying this parameter, 4 requests will be sent by default.

    L Size \u003d Specifies the size of the ECHO request package (from 32 to 65.527). Without specifying this option, Ping sends echo queries in 32 bytes.

    F \u003d Prevents ECHO-requests to fragmentation by routers located in a chain between you and the target device. The -F option is often used to debug problems associated with PMTU ( Path Maximum Transmission Unit).

    I TTL \u003d sets the duration of TTL ( Time To Live.), the maximum value of which is 255.

    V TOS \u003d Sets the TOS value ( Type of Service.). The parameter does not work in Windows 7 and higher.

    R number \u003d this option for ping teams You need to use to specify the number of transitions between your and the target computer you want to record and output. The maximum value is 9, so if you are interested in finding the exact number of links between two devices, it is better to use Tracert.

    S Number \u003d time in the Internet TimeStamp format, which is obtained and sent each ECHO request. The maximum value here is 4, which means that you can fix only the first 4 transitions.

    W timeOout \u003d timeout values \u200b\u200bin milliseconds during which Ping will expect each response. If you do not use the -W option, then the default timeout will be 4000 milliseconds ( 4 seconds).

    R \u003d Using the title for checking also the offline route.

    S srcaddr \u003d used source address.

    P \u003d Used to check the address status Hyper-V Network Virtualization.

    4 \u003d Checking the connection status only by IPv4 protocol. This is required when the goal has only the host name and is unknown an IP address.

    6 \u003d Forced checking for the IPv6 connection status. This is necessary when only the host name is known.

    target \u003d Remote device whose status must be checked. It can be like an IP and host name.

    /? \u003d conclusion of certificate about all available parameters Ping teams.

    Note: -F, -V, -R, -S, -J and -K work only when checking the status of IPv4 addresses. Options -R and -S work only with IPv6 protocol.

    In the Ping Team Description There are less popular parameters: [-j host-list], [-K host-list] and [-C compartment]. To obtain additional information About them, use the / command? .

    Examples of Ping Team

    ping -N 5 -L 1500 www.google.com

    In this example, the Ping command is used to check the host status www.google.com. Option -N Specifies the Ping command to the need to send five ECHO requests ICMP instead of standard four, and the -L option sets the package size for each 1500 bytes request instead of 32 bytes by default. With this request, you will receive the following result:

    Pinging www.google.com With 1500 Bytes of data: reply from 74.125.224.82: bytes \u003d 1500 Time \u003d 68ms TTL \u003d 52 Reply from 74.125.224.82: bytes \u003d 1500 TIME \u003d 68MS TTL \u003d 52 Reply From 74.125.224.82: Bytes \u003d 1500 Time \u003d 65ms TTL \u003d 52 Reply from 74.125.224.82: Bytes \u003d 1500 Time \u003d 66ms TTL \u003d 52 Reply From 74.125.224.82: Bytes \u003d 1500 Time \u003d 70ms TTL \u003d 52 Ping Statistics for 74.125.224.82: Packets: Sent \u003d 5, Received \u003d 5, Lost \u003d 0 (0% LOSS), Approximate Round TRIP TIMES IN MILLI-SECONDS: Minimum \u003d 65ms, Maximum \u003d 70ms, Average \u003d 67ms

    Clause 0% LOSS in statistics of the status check 74.125.224.82 suggests that all Echo requests sent to www.google.com were returned. This means that as long as the network is active, you can interact with the Google site without any problems.

    In this example using the Ping command in CMD, the state of 127.0.0.1 is checked, which is also known as the LocalHost IP address in the IPv4 protocol.

    Ping 127.0.0.1 - a great way to check the performance of all windows functions . But with this request it will not be possible to learn about the state of your or remote computer. There is an IPv6 version of this check - Ping :: 1.

    ping -A 192.168.1.22

    In this example, we are trying to find out the host name attached to the IP address 192.168.1.22. In this case, the check must be carried out in normal mode, even if the host name cannot be found.

    Pinging J3RTY22 WITH 32 Bytes Of Data: Reply From 192.168.1.22: Bytes \u003d 32 Time<1ms TTL=64 Reply from 192.168.1.22: bytes=32 time<1ms TTL=64 Reply from 192.168.1.22: bytes=32 time=1ms TTL=64 Reply from 192.168.1.22: bytes=32 time<1ms TTL=64 Ping statistics for 192.168.1.22: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 1ms, Average = 0ms

    As can be seen from the above example, the Ping command in Windows 7 has identified the IP address checked as the name of the J3RTY22 host, after which the status is validated during standard settings.

    ping -T -6 Server

    In this example, we, using the -6 option, turn on the forced use of the IPv6 protocol, and then proceed to an endless test of the Server state ( using the -t option).

    Pinging Server WITH 32 Bytes of Data: Reply From Fe80 :: FD1A: 3327: 2937: 7DF3% 10: Time \u003d 1ms Reply From Fe80 :: FD1A: 3327: 2937: 7DF3% 10: Time<1ms Reply from fe80::fd1a:3327:2937:7df3%10: time<1ms Reply from fe80::fd1a:3327:2937:7df3%10: time<1ms Reply from fe80::fd1a:3327:2937:7df3%10: time<1ms Reply from fe80::fd1a:3327:2937:7df3%10: time<1ms Reply from fe80::fd1a:3327:2937:7df3%10: time<1ms Ping statistics for fe80::fd1a:3327:2937:7df3%10: Packets: Sent = 7, Received = 7, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 1ms, Average = 0ms Control-C ^C

    After seven received answers, we intentionally interrupted a state check. Remember how to stop the Ping command? Using Ctrl + C. Also -6 led to the use of addresses on the IPv6 protocol.



    Did you like the article? Share it