Computers Windows Internet

Start persistent ping. Lost connection to the server. Trace and ping. What You Can Do With Ping

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

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

However, it is not always possible to come across 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 to 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 -> Execute -> cmd

There are many terminals in this OS, so any of those installed on the PC can be used for these purposes. Usually the standard terminal can be started with the 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 you can see from the results, 4 packets of 32 bytes were transmitted and received. The exchange time for one packet was 47 milliseconds.

It's worth noting that Windows only sends 4 packets by default. In Linux, the exchange of packages continues until the user himself stops the process with a keyboard shortcut CTRL+C... To ping the same way on Windows, you need to use the parameter -t... For example:

Ping -t 11.222.33.44

To stop sharing packages is done with the same keyboard shortcut - CTRL+C.

Setting the number of packets to send

To set the maximum number of sent packets, you need to 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

Changing the size of sent packets

To ping packets of a specific size (in bytes), 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, 64-byte packets were sent.

Route tracing can show the rate at which packets travel between routers that connect the requesting PC and the destination server.

The following command is used to perform tracing:

Windows:

Tracert

for example:

Tracert wikipedia.org

Traceroute

for example:

Traceroute wikipedia.org

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

To activate this option, you must use the following kind of command:

Windows:

Tracert -d

Traceroute -n

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

Learn the basics of teamwork with this tip. 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 command line.

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

Let's ping (check availability) any address you know on the Internet, 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 link loss and packet delay time. You can interrupt the execution of the command at any time by pressing "ctrl C"

To provide statistics to the service technical support internet service provider, 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 readability of the statistics file, you may need to change the font in Notepad. It's easy to do - open from above in Notepad: Format -> Font and select terminal.

As you can see, the command ping very easy to use!

Command PING it is perhaps the most used network command line utility. PING present in all versions of all operating systems is network-enabled and provides a simple and convenient means of polling a host by name or IP address.

For the exchange of service and diagnostic information in the network, a special protocol of control messages is used. ICMP(Internet Control Message Protocol). Command ping allows you to send a control message like Echo Request(the type is 8 and is indicated in the header of the ICMP message) to the addressed host and interpret the response received from it in a form convenient for analysis. The data field of the sent icmp packet usually contains English characters. In response to such a request, the polled node must send an icmp packet with the same data that was received and the type of message Echo Reply(the type code in the ICMP header is 0). If any problem occurs during the exchange of icmp messages, the ping utility will display information to diagnose it.

Command line format:

Ping [-t] [-a] [-n number] [-l size] [-f] [-i TTL] [-v TOS] [-r number] [-s number] [[-j HostList] | [-kNodelist]] [-w timeout] endName

Options:

-t- Continuous sending of packets. To terminate and display statistics, use key combinations Ctrl + Break(output statistics and continue), and Ctrl + C(statistics output and completion).
-a- Determination of addresses by names of nodes.
-n number- The number of echo requests to send.
-l size- The size of the data field in bytes of the sent request.
-f- Setting the flag prohibiting fragmentation of the packet.
-i TTL- Setting the packet lifetime ("Time To Live" field).
-v TOS- Setting the type of service (field "Type Of Service").
-r number- Route recording for the specified number of hops.
-s number- Time stamp for the specified number of transitions.
-j list of Nodes- Free choice of route according to the list of nodes.
-k list of Nodes- Rigid route selection according to the list of nodes.
-w timeout- The maximum waiting time for each response in milliseconds.

Examples of using:

ping google.com- echo request to node named google.com with default parameters - the number of packets is 4, the length of the data array = 32 bytes.

ping -6 ya.ru- ping node ya.ru using Ipv6 protocol

ping -a 192.168.1.50- perform a ping with the definition of the name of the horse node by its address.

ping -s 192.168.0.1 computer- ping node computer from source 192.168.0.1. It is used when the computer has several network interfaces.

ping w 5000 ya.ru- ping with a wait timeout of 5 seconds (by default - 4 seconds).

ping -n 5000 -l 1000 site- node polling site 5000 times, in data packets 1000 bytes long. The maximum allowed data length is 65500.

ping -n 1 -l 3000 -f ya.ru- ping with prohibition of packet fragmentation.

ping -n 1-r 3 ya.ru- send 1 echo request per node ya.ru with the display of the first 3 transitions along the route.

ping -i 5 ya.ru- ping with TTL = 5. If more hops are required to reach the end node, the router that interrupted the delivery will respond with the message “Time to Live (TTL) exceeded when transmitting the packet.”

  • PING application for step-by-step diagnostics Internet access problems:
  • Generalized connection diagram of a computer (tablet, laptop home network) with a remote endpoint can be represented as follows:

    The home network is the most common network with IP addresses 192.168.1.0 /255.255.255.0. We are talking about IPv4 - IP protocol version 4, where 4 bytes are used for addressing. IP addresses it is customary to represent bytes as decimal values, separated by dots. Each device on the network must have its own unique address. In addition to the address, the network settings use mask network (subnet mask). The mask has the same presentation format as the address. The combination of address and mask determines the range of addresses that belong local network- 192.168.1.0-192.168.1.255. The first and last addresses in the range are not assigned to individual network devices, as they are used as the network address and broadcast address. Usually, the router address is made equal to 192.168.1.1 or 192.168.1.254. This is not an obligatory standard, but in practice it is used quite often. One bits of the mask define the permanent part of the IP address of the network, and zero bits are allocated to individual nodes. Meaning 255 is a byte with bits set to one. The netmask serves as a means of determining the range of IP addresses that belong to a local network. Devices with such addresses are reachable locally, without using routing... Routing is a way of exchanging data with network devices that do not belong to this local network through a special device - router(router, router). Routers are specialized computers with several network interfaces and specialized software providing the forwarding of IP packets between the sender and the recipient, located in different networks. Several routers can participate in such a forwarding, depending on the complexity of the route. A home router is the simplest type of router that provides forwarding of packets addressed to external networks to the next router along the route in the provider's network. The next router checks the reachability of the end-node address locally, and either forwards the data to it, or passes it on to the next router according to the route table. This happens until the data reaches the recipient or the packet's lifetime expires.

    The PING command can be used to diagnose individual nodes:

    ping 127.0.0.1 is the ping of the loopback interface. Should run without error if installed and in working condition network software components.

    ping your IP or name- ping to your own address or name. Should exit without error if all IP software is installed and working properly network adapter.

    ping the IP address of the router- should be performed if the computer's network card is working, the cable or wireless connection used to connect to the router is working, and the router itself is working. In addition, the IP settings must be such that the address of the computer and the router belongs to the same subnet. This is usually the case when network settings are performed automatically by means of the DHCP server of the router.

    ping yandex.ru- perform a poll of a node with a name yandex.ru... If the poll ends with an error, then the reason may be not only the lack of communication with the provider's router, but also the impossibility of determining the host address. yandex.ru due to problems with by software name resolution.

    ping 8.8.8.8- to poll the node with the IP address 8.8.8.8. If polling by address completes without errors, and polling by name ends with an unknown host message, then the problem is in name resolution. The reason may be the inoperability of the provider's DNS server. In this case, you can try to change it in the settings network connection to public DNS servers Google with addresses 8.8.4.4 and 8.8.8.8. Also, the problem may be caused by poor quality communication with the provider, which is accompanied by too long response time and loss of packets.

    ping -t yandex.ru- ping until CTRL + C is pressed. When CTRL + Break is pressed, statistics are displayed and the node polling continues.

    Ping -n 1000 -l 500 192.168.1.1 - ping 1000 times using messages that are 500 bytes long. Ping with standard 32-byte packets can be performed without errors, and with long packets - with errors, which is typical for wireless connections with a low signal level in an environment of intense interference.

    Ping -n 1 -r 9 -w 1000 yandex.ru - ping 1 time (switch -n 1), issue a route for the first 9 hops (-r 9), wait for a response 1 second (1000ms)

    As a result of executing this command, the route trace is also displayed:

    Exchange of packets with yandex.ru with 32 bytes of data:
    Reply from 87.250.251.11: bytes = 32 time = 36ms TTL = 54
    Route: 81.56.118.62 ->
    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:

    Packets: Sent = 1, Received = 1, Lost = 0
    (0% loss)
    Approximate round-trip time in ms:
    Minimum = 36ms, Maximum = 36ms, Average = 36ms

    V this example, a chain of 9 routers is built between the sender and the receiver of packets. It is necessary to take into account the fact that in the version of the utility ping.exe for Windows, the number of jumps can range from 1 to 9. In cases where this value is not enough, use the command tracert

    A failure to echo is not always a symptom of a problem, as sometimes, for security reasons, some peers are configured to ignore ping pings. An example is the node microsoft.com and some routers in small ISP networks.

    Using PING in batch files.

    Often times, the PING command is used to create delays in batch files. The loopback interface is pinged indicating desired value the packet counter specified by the parameter -n... Echo requests are sent every 1 second, and the response on the loopback interface comes almost instantly, so the delay will be approximately equal to a counter minus one:

    ping -n 11 127.0.0.1- a delay of 10 seconds.

    The PING command is used in batch files to determine the availability of IP addresses. Since the poll result is not reflected in the ERRORLEVEL variable in any way, instead of analyzing it, the search for certain features in the PING standard output data is used. If you look closely at the messages of the ping.exe program when polling the available and unavailable nodes, you will notice that they differ significantly

    ping 456.0.0.1- ping to a non-existent address

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

    Ping test failed to locate node 456.0.0.1. Please check the hostname and try again.

    ping yandex.ru- ping to the host address yandex.ru

    Responding to ping an accessible node:

    Exchange of packets from yandex.ru to 32 bytes:
    Reply from 87.250.250.11: bytes = 32 time = 10ms TTL = 55

    Thus, to solve the problem of determining the availability of a node in a batch file, it is enough to analyze the characteristic words in the output of ping.exe with a successful response. Most characteristic in this case is the presence of the word TTL... It is never encountered when an error occurs and is just English characters. To search for "TTL" in ping.exe results, it is most convenient to chain its execution with the command to search for a character string FIND.EXE(ping and find pipeline). If the text is found with the FIND command, then the value of the ERRORLEVEL variable will be equal to 0

    ping -n 1 COMPUTER | find / I "TTL"> nul
    if% ERRORLEVEL% == 0 goto LIVE
    ECHO computer not available
    unavailable state routine
    ...
    Exit
    : LIVE - start of the node availability state processing routine
    ...
    ...

    In a simpler version, you can use the commands:

    PING yandex.ru | find "TTL =" && ECHO Yandex pingable- the ECHO command is executed if the ERRORLEVEL value set by FIND is 0, i.e. node yandex.ru replies to ping.

    PING Server64 | find "TTL =" || ECHO Server64 not pingable- the ECHO command is executed if the ERRORLEVEL value set by FIND is not equal to 0, i.e. knot Server64 did not respond to ping.

    The ping command is used to ensure that the computer can communicate with the Network and the resources within it. Ping works by sending echo request messages via ICMP ( Internet Control Message Protocol) and waiting for a response. It lets you know how many responses were received and how long it took:

    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 = This option will ping the target device until you forcefully stop the request with the keyboard shortcut Ctrl + C.

    A = will query the hostname of the target IP address.

    N number = specifies the number of ICMP messages to be sent. If you execute the ping command without specifying this parameter, then 4 requests will be sent by default.

    L size = sets the size of the echo request batch (from 32 to 65.527). Without this option, ping will send echo requests that are 32 bytes in size.

    F = Prevents echo requests from being fragmented by routers in the chain between you and the target. The -f option is often used to debug PMTU ( Path Maximum Transmission Unit).

    I TTL = sets the duration of the TTL ( Time to live), the maximum value of which is 255.

    V TOS = sets the TOS value ( Type of Service). The parameter does not work on Windows 7 and above.

    R number = This ping option should be used to specify the number of hops between your and the target computer that you want to log and output. The maximum value is 9, so if you are interested in knowing the exact number of links between two devices, then it is better to use tracert.

    S number = Time in Internet Timestamp format for each echo request to be received and sent. The maximum value here is 4, which means that you can only fix the first 4 transitions.

    W timeout = The timeout values, in milliseconds, that ping will wait for every response. If you do not use the -w option, then the default timeout will be 4000 milliseconds ( 4 seconds).

    R = use header to check the reverse route as well.

    S srcaddr = source address to use.

    P = used to check the status of the address Hyper-V Network Virtualization.

    4 = Checks the connection status of IPv4 only. This is required when the target only has a hostname and the IP address is unknown.

    6 = Force check the status of the IPv6 connection. This is necessary when only the hostname is known.

    target = the remote device to check for status. It can be either IP or hostname.

    /? = Displays help for all available ping options.

    Note: -f, -v, -r, -s, -j and -k only work when checking the status of IPv4 addresses. The -R and -S options only work with IPv6.

    There are also less popular options in the ping command: [-j host-list], [-k host-list], and [-c compartment]. To obtain Additional information about them, use the command /? ...

    Ping Command Examples

    ping -n 5 -l 1500 www.google.com

    This example uses the ping command to check the status of the host www.google.com. The -n option tells the ping command to send five ICMP echo requests instead of the standard four, and the -l option sets the packet size for each request to 1500 bytes instead of the default 32 bytes. With such a request, you will receive the following result:

    Pinging www.google.com with 1500 bytes of data: Reply from 74.125.224.82: bytes = 1500 time = 68ms TTL = 52 Reply from 74.125.224.82: bytes = 1500 time = 68ms TTL = 52 Reply from 74.125.224.82: bytes = 1500 time = 65ms TTL = 52 Reply from 74.125.224.82: bytes = 1500 time = 66ms TTL = 52 Reply from 74.125.224.82: bytes = 1500 time = 70ms TTL = 52 Ping statistics for 74.125.224.82: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 65ms, Maximum = 70ms, Average = 67ms

    The 0% loss clause in the 74.125.224.82 check statistic indicates that all echo requests sent to www.google.com have been returned. This means that as long as the network is active, you can interact with the Google site without any problems.

    This example ping cmd checks the status of 127.0.0.1, which is also known as the IP address localhost in IPv4.

    Ping 127.0.0.1 - great way check the performance of all Windows functions... But with the help of this request it will not be possible to find out about the state of your or remote computer... There is also an IPv6 version of this check, ping :: 1.

    ping -a 192.168.1.22

    In this example, we are trying to find out the hostname associated with the IP address 192.168.1.22. In this case, the check should be carried out normally, even if the hostname cannot be found out.

    Pinging J3RTY22 with 32 bytes of data: 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 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 you can see from the above example, the ping command in Windows 7 defined the IP address to be checked as the hostname J3RTY22 and then performed a status check with default settings.

    ping -t -6 SERVER

    In this example, we use the -6 option to enable IPv6 enforcement, and then proceed to endlessly checking the status of SERVER ( using the -t option).

    Pinging SERVER with 32 bytes of data: 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 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 receiving seven responses, we deliberately interrupted the status check. Remembering how to stop the ping command? With Ctrl + C. Also -6 led to the use of IPv6 addresses.

    The Windows command line, as a rule, is not used by most users, perhaps because not everyone knows what commands to use in one case or another, how useful it can sometimes be, or in general - what is it?

    If you are one of those users, I hope this article helps you get started using it. 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 the running process Ctrl + C

    The first command you should know is the simultaneous pressing of the two Ctrl and C keys. This combination stops almost any team. 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 the wrong one, you can use the Ctrl + C combination.

    Attention! This command is not a 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 local network connection:

    You can find out more complete information 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 a cable to create a local network). You need to make sure 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 see the inscription The specified node is not available. You can stop this command with Ctrl + C.

    5. Exit from the command line exit.

    With the exit command, you can close the command prompt window.

    6. Copying files xcopy.

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

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

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

    Enter the command cmd or start 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. Checking system files sfc / scannow.

    Malicious software sometimes tries to replace the modified versions of the kernel files in order to gain control of the system. System File Checker can be used to check the integrity of Windows system files. If any files are damaged 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 are using.

    If you need a little more information, you can add the Latin letter V (this is how driverquery-V would look like).

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

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

    11. Paste text

    In order to paste the text into the command line, you need, as usual, to copy it from the source, and then just click once with the right mouse button in the area of ​​the black screen.