How to interrupt ping on the command line. Description of the PING command

In the work of every IT specialist supporting the Internet communication channel, the question arises of the quality and reliability of the services provided by Internet providers. The main testing tool is the ping command.

From this tip you will learn about the basic techniques of working with a team ping on Windows.

Let's look at some examples of using this command:

To check the channel, we will use the ping utility, which we will run from the command line.

The command line is launched through the Start button -\u003e Run (for windows), we write cmd and press the Enter key. The following window will open:

Ping (check availability) any address on the Internet you know, for example, mail.ru:

By default, the ping utility sends 4 packets to this address. In order to understand what losses are on the channel, you should put the –t switch:


Thus, you can see the loss on the channel and the delay time of the packets. You can interrupt the execution of the command at any time by pressing "ctrl C"

To provide statistics to the service technical support ISP, you need to save the results to a file. Run the ping command like this:

ping mail.ru –t –w 10000 >testmail.txt

Wait for the required testing time and press "ctrl C" to interrupt the recording:

For the readability of the statistics file, you may need to change the font in Notepad. It's easy to do - open the top in Notepad: Format -> Font and select terminal.

As you can see, the team ping very easy to work!

The ping command sends data packets to specific IP address on the network, and then lets you know how long it took to transmit that data and get a response. This handy tool, which you can use to quickly test different points in your network. Here's how to use it.

How ping works

Ping comes from a term used in sonar technology that sends out pulses of sound and then listens for the echo to return. IN computer network The ping tool is built into most operating systems, which work in much the same way. You issue the ping command along with a specific URL or IP address. Your computer sends several packets of information to this and then waits for a response. When it receives a response, the ping tool shows you how long each packet took to make this journey, or tells you that there was no response.

It sounds simple and it is. You can check if your computer can connect to another device, such as your router, in local network or to a device on the Internet. This can help you determine if the network problem is somewhere on your local network or somewhere else. The time it takes for packets to return can help you identify a slow connection or if you're experiencing packet loss.

And it doesn't matter which operating system You are using. Bring up a terminal or command prompt window and you can ping on MacOS, Linux, or any version of Windows.

How to use ping

We are going to use the Windows Command Prompt in our example here. But you can also use the ping command in Windows PowerShell or in the Terminal app on macOS or any Linux distribution. Once you get to the actual command, it works the same everywhere.

In Windows, press Windows + R. In the Run window, type "cmd" in the search box and press Enter.

At the command prompt, type "ping" along with the URL or IP address you want to check and press "Enter".

This response shows the URL you are viewing, the IP address associated with that URL, and the size of the packets being sent on the first line. The next four lines show the responses from each individual packet, including the time (in milliseconds) it takes to respond and the packet's TTL, which is the amount of time that must elapse before the packet is discarded.

At the bottom, you'll see a summary that shows how many packets were sent and received, as well as the minimum, maximum, and average response times.

And in the following figure, we are pinging a router on our LAN using its IP address. We also get a normal response from him.

When the ping tool does not receive a response from any devices you have pinged, it also lets you know.

And here's how to use ping for real basic level. Of course, like most commands, there are a few extra options you can use to make it behave differently. For example, you can have it keep track of a destination until you stop a command, specify how many times you want it to ping, set how often it should ping, and more. But, unless you're doing some specific types of troubleshooting, you don't need to worry about these advanced options.

If you're interested, just type "ping /?" On the command line to see a list of options.

What You Can Do With Ping

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

  • Ping a URL (such as a website) or IP address to see if you can reach the Internet destination. If you receive a successful response, you know that everything network devices between you and this recipient work, including the network adapter on your computer, your router, and any devices on the Internet between your router and the destination. And if you're interested in learning more about these routes, you can use another web tool called tracert to do just that.
  • Ping the URL to see its IP address. If you want to know the IP address for a specific URL, you can submit the URL. The ping tool shows you at the top the IP address it's working with.
  • Ping your router to see if you can reach it. If you are unable to successfully ping an Internet address, you can try to ping your router. A successful response lets you know that your local network is working properly and the problem with accessing the website is somewhere beyond your control.
  • Ping your loopback address (127.0.0.1). If you are unable to successfully ping the router, but your router appears to be up and running, you can try pinging the so-called loopback addresses. This address is always 127.0.0.1, and testing it successfully lets you know that the network adapter on your computer (and network software on your OS) works correctly.

Note: You cannot receive a ping response from other computers on the local network because the built-in firewalls on these devices prevent them from responding to ping requests. If you want to be able to ping these devices, you will need to disable this setting to allow traversal through the firewall.

The list above takes an external approach where you first send a request to the most remote destination and then work your way to more local devices. Some people like to work the other way around, first ping the loopback address, then the router (or whatever local device), followed by an Internet address.

And, of course, what we're talking about in this article mostly refers to using ping to troubleshoot a home or small business network. Also, if you're tasked with troubleshooting large networks, you probably already know how to use ping and many other networking tools.

Command line Windows is generally not used by most users, perhaps because not everyone knows what commands to use in this or that case, how useful it can sometimes be, or in general - what is it?

If you are one of those users, I hope this article will help you get started. Perhaps you just forgot some command, and here I hope to help you.

At first glance, rj may seem like a boring, complicated, or useless tool, but I assure you, it is not!

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

Basic cmd commands.

1. Forced stop of a running process Ctrl+C

The first command you should know is to press two buttons at the same time. Ctrl keys and S. This combination stops almost any command. If you find an error in the entered command, you can simply erase unnecessary characters using the backspace button, but if you have already launched something that was not required, you can use the Ctrl + C combination.

Attention! This command is not Magic wand! She will not be able to cancel those processes that cannot be canceled, so be careful!

2. Calling help on the command /?

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

3. Information about your network connection

This command will display information about your LAN connection:

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

4. Ping test (connection test) ping

Let's say you have two computers connected via an Ethernet cable (we have already discussed how to crimp the cable to create a local network). You need to be sure that there is a connection between them. To do this, you need to run ping 192.168.0.5 from a computer whose ip address is 192.168.0.1 (where 192.168.0.5 is the ip address of the second computer).

If everything is in order, then pings will appear in front of you. If something is done wrong, you will have the inscription The specified node is not available. You can stop this command with Ctrl+C .

5. Exit from the command line exit .

You can close the command line window with the exit command.

6. Copying xcopy files.

A very useful tool for copying files. Let's say you want to copy photos from drive C to an external drive.

Dial xcopy c:photo f:photo /s /e(where f is the external drive).

6. Checking the time time .

If you need to customize by typing time , you will be presented with current time. And here you will be prompted to change the time to the correct one.

7. Open a new command prompt window cmd or start .

Enter the cmd or start command and a new command prompt window will open in front of you. You can also just clear the active window. To do this, type the command cls (clear screen).

8. Verification system files sfc /scannow.

Malicious software sometimes tries to replace system kernel files with modified versions in order to take control of the system. System File Checker can be used to check the integrity of files Windows systems. If any files are corrupted or deleted, they will be replaced.

9. Information about installed drivers driverquery.

If you want to see what drivers are installed on your PC, you can do so by running the driverquery command. This command provides information about each driver you have.

If you need a little more information, you can add the Latin letter V (here's what driverquery-V would look like) .

10. Find out the ip-address of the site nslookup site.ru

Type nslookup site.ru in the command line to find out the IP address of site.ru.

11. Insert text

In order to paste text into the command line, you need to copy it from the source as usual, and then simply right-click once in the black screen area.

I think any administrator knows the ping command, which is used to check the availability of hosts. If you are an experienced administrator, most likely you will not learn anything new from this article. If your knowledge is limited to the banal ping ya.ru, I advise you to read the article to the end.

Example 1: Changing the time interval between sending packets

By default, packets are sent at one second intervals. You can change this interval with the -i option.

Increasing the interval

Example: Wait 5 seconds before sending the next packet.

$ ping -i 5 IP

Decrease the interval

Example: Wait 0.1 second before sending the next packet.

# ping -i 0.1IP

The note: Only the superuser can specify an interval less than 0.2 seconds. Otherwise, you will see this message.

$ ping -i 0.1 127.0.0.1 PING 0 (127.0.0.1) 56(84) bytes of data. ping: cannot flood; minimal interval, allowed for user, is 200ms

Example 2: Checking the local interface

Before checking remote host first it is recommended to check if everything is in order with your local interface. To do this, you can use the following 3 methods.

Ping zero (0)

This is the simplest and fast way:

$ ping 0 PING 0 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.024 ms ^C

Ping by name

$ ping localhost PING localhost (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.051 ms 64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.055 ms ^C --- localhost ping statistics -- - 2 packets transmitted, 2 received, 0% packet loss, time 999ms rtt min/avg/max/mdev = 0.051/0.053/0.055/0.002 ms

Ping by IP

$ ping 127.0.0.1 2 packets transmitted, 2 received, 0% packet loss time 999ms rtt min/avg/max/mdev = 0.051/0.053/0.055/0.002 ms

There should be no packet loss.

Example 3: Send N packets and exit

The -c option is used to end the ping automatically after sending the number of packets you specify.

In the following example, we will send 5 packets.

$ ping -c 5 google.com PING google.com (74.125.45.100) 56(84) bytes of data. 64 bytes from yx-in-f100.google.com (74.125.45.100): icmp_seq=1 ttl=44 time=731 ms 64 bytes from yx-in-f100.google.com (74.125.45.100): icmp_seq=2 ttl =44 time=777 ms 64 bytes from yx-in-f100.google.com (74.125.45.100): icmp_seq=3 ttl=44 time=838 ms 64 bytes from yx-in-f100.google.com (74.125.45.100 ): icmp_seq=4 ttl=44 time=976 ms 64 bytes from yx-in-f100.google.com (74.125.45.100): icmp_seq=5 ttl=44 time=1071 ms --- google.com ping statistics -- - 5 packets transmitted, 5 received, 0% packet loss, time 4216ms rtt min/avg/max/mdev = 731.039/879.129/1071.050/126.625 ms

Example 4: Version of the ping command

With the -V option, we can see current version commands.

$ ping -V ping utility, iputils-sss20071127

Example 5. Flood in the network

The superuser can send thousands or more packets in a short amount of time with the -f option.

As shown below, ping -f sent over 400,000 packets in a few seconds.

# ping -f localhost PING localhost (127.0.0.1) 56(84) bytes of data. .^C --- localhost ping statistics --- 427412 packets transmitted, 427412 received, 0% packet loss, time 10941ms rtt min/avg/max/mdev = 0.003/0.004/1.004/0.002 ms, ipg/ewma 0.025/0.004 ms

Example 6. Beep

This option is rarely used, but it can be very useful. You start a ping, there is no response from the host, you figure out what's wrong, and as soon as the problem is solved and the remote host answers, you will hear a sound.

$ ping -a IP

Example 7: Print only command execution statistics

With the -q option, you can skip replies from the remote host and display the statistics immediately.

$ ping -c 5 -q 127.0.0.1 PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. --- 127.0.0.1 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3998ms rtt min/avg/max/mdev = 0.047/0.053/0.061/0.009 ms

Example 8: Changing the batch size

You can change the size of the sent packet using the -s option.

Example: Let's change the packet size from 56 to 100.

$ ping -s 100 localhost PING localhost (127.0.0.1) 100(128) bytes of data. 108 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.022 ms icmp_seq=3 ttl=64 time=0.020 ms ^C --- localhost ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 1998ms rtt min/avg/max/mdev = 0.020/0.021/0.022/ 0.000ms

Example 9. Command execution time

With the -w option, we can specify the command execution time in seconds.

In the following example, we will ping the localhost for 5 seconds.

$ ping -w 5 localhost

The note: If the -w and -c options are used simultaneously, the utility will terminate when the first restriction is triggered.

Example 10. Brief statistics with SIGQUIT

Without interrupting the ping command, you can view the execution statistics. For this you need to press CTRL + |

$ ping -w 100 localhost PING localhost (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=10 ttl=64 time=0.021 ms 64 bytes from localhost (127.0.0.1): icmp_seq=11 ttl=64 time=0.022 ms 11/11 packets, 0% loss, min/avg/ewma/max = 0.020/0.022/0.022/0.024 ms 64 bytes from localhost (127.0.0.1): icmp_seq=12 ttl=64 time=0.021 ms icmp_seq=14 ttl=64 time=0.021 ms 64 bytes from localhost (127.0.0.1): icmp_seq=15 ttl=64 time=0.021 ms 19/19 packets, 0% loss, min/avg/ewma/max = 0.020/0.022/0.022/0.024 ms 64 bytes from localhost (127.0.0.1): icmp_seq=31 ttl=64 time=0.022 ms 64 bytes from localhost (127.0.0.1): icmp_seq=32 ttl=64 time=0.022 ms 32/32 packets, 0% loss, min/avg/ewma/max = 0.020/0.022/0.022/0.027 ms 64 bytes from localhost (127.0.0.1): icmp_seq=33 ttl=64 time=0.023 ms ..

The best tableware from world brands in the online store: BergHOFF, Luminarc, Vitesse

On the Internet, in particular, on forums, in the event of a problem with connecting to any node (), it is recommended to check the ping or perform a route trace and thus check the availability of the server.

But what is ping and what is tracing? Ping (ping) is a tool (utility) for checking the integrity of the connection in networks based on TCP / IP. Traceroute (traceroute or tracert command) is a program for determining data routes in TCP/IP networks.

However, it is not always possible to find information on how exactly this check is performed: how to ping or how to make a trace.

Ping check

To check the ping, use the command of the same name ping, which must be entered on the command line. You can start the command line in the following ways:

Windows:

1) Start -> All programs -> Standard -> Command line

2) Start -> Run -> cmd

There are many terminals in this OS, so for these purposes you can use any of those installed on your PC. Usually a standard terminal can be launched with a keyboard shortcut CTRL+ALT+T.

So, to ping a specific server, you need to run the command:

Ping

For example, to ping an address 11.222.33.44 you need to run the command:

Ping 11.222.33.44

Below is an example of the results of pinging one of the IP addresses.

As can be seen from the results, 4 packets of 32 bytes in size were transmitted and received. The exchange time for one packet was 47 milliseconds.

Note that Windows only sends 4 packets by default. On Linux, the packet exchange continues until the user himself stops the process with a keyboard shortcut. CTRL+C. To run ping in the same way on Windows, you need to use the parameter -t. For example:

Ping -t 11.222.33.44

Stopping the exchange of packets is performed by the same key combination - CTRL+C.

Setting the number of packets to send

To set the maximum number of packets to be sent, use the following command:

Windows:

Ping-n<число_пакетов>

For example:

Ping -n 5 11.22.33.44

Ping -c<число_пакетов>

For example:

Ping -c 5 11.22.33.44

Change the size of sent packets

To ping using packets of a certain size (in bytes), you must use the following command:

Windows:

Ping -l<размер_пакетов>

For example:

Ping -l 64 11.22.33.44

Ping -s<размер_пакетов>

For example:

Ping -s 64 11.22.33.44

In this case, packets of 64 bytes in size were sent.

A traceroute can show the rate at which packets travel between routers that connect the requesting PC to the destination server.

The following command is used to run a trace:

Windows:

Tracert

For example:

Tracert wikipedia.org

traceroute

For example:

Traceroute wikipedia.org

It is worth noting that, by default, tracing also performs a DNS query to resolve the IP address in Domain name for each passing router. This option can be disabled, thus reducing the time it takes to get trace results.

To enable this option, you must use the following command type:

Windows:

Tracert-d

Traceroute -n