How to set up smartphones and PCs. Informational portal
  • home
  • Windows 7, XP
  • Help for the ping command and its options. Ping switches and examples of its use

Help for the ping command and its options. Ping switches and examples of its use

To check the connection on the network, a special system command ping is used, which sends an ICMP request to a resource with a specific address on the network and displays the result that comes in response from this device.

That is, the ping command helps to determine the amount of time it takes to transfer certain data from one device to another.

The shorter the latency, the faster the connection between the two nodes is.

What is ping

Ping is the length of time during which a packet sent from one device on the network will be delivered to another device on the network and will be returned back.

The higher the ping, the longer, for example, the waiting time required to open a web page.

There is one more concept in relation to Ping, bordering on the first. Ping is also the most popular command for determining the speed of access to certain network devices. It can be used as the primary means of determining the return period for packets along the route of interest.

Ping should be used with any Internet site, including to control the quality of connection with terminal equipment. At the same time, ping allows you to quickly establish the presence or absence of connection problems at the physical (broken, damaged cable, failure of the network card, etc.) and software (for example, blocking all network traffic) levels.

Pinging is when you send a certain number of data packets from one device to another device, both on the local network and on the Internet. Thanks to this exchange of packages, you can get information on the quality of the connection.

If there are no received responses from the device being tested, then there are connection problems. Packets that did not come back are called "losses". The higher the number of lost packets, the worse. If all sent packets are lost, then this means either the absence of a network connection, or the unavailability of the pinged device.

The ping speed is very important: the lower it is, the faster and more reliable the connection between nodes.

Video: ping check

Verification methods

To test the connection using pinging, you can either run the ping command from the operating system console, or use specialized online services.

Through the command line

To check the ping through cmd, you need to do the following sequence of actions:

  • open a command prompt in one of three ways:


Online

An alternative option to check the ping to the server online is to use online services. These Internet services allow you to check the availability of an information resource and the waiting time of users.

Let's consider the most common ones:


How to check the ping to the router

The fastest and easiest way in Windows to check the ping to the router is to use the Ping command. To do this, you first need to find out its ip-address. It is usually printed on the back of the router case. Most often, the router has the following ip address 192.168.1.1.

In the command line, type the command: ping 192.168.1.1 -t.

If the router has an IP address of 192.168.0.1 (as is the case with D-Link routers), then the command should be: ping 192.168.0.1 –t.

The -t parameter means that pings will be sent until the user interrupts the process by pressing the Ctrl + C keyboard shortcut, or closes the console window. A successful ping result is shown in the figure:

This result indicates that the ip-address is available and responses to ICMP requests are coming. If the router pings, therefore, we can talk about its availability from the workstation. In such a situation, you can connect to the settings of the router through its web interface.

If the IP address of the router is not available and there is no response from the device, then the result of the ping command is as follows:

Photo: the result of the ping command

In such a situation, you need to check which ip-address is set in the settings of the network card, try to change the port in the router and, in extreme cases, reset the router settings to the factory settings.


Usually, ping is discussed in the case of an increase in the time between operations on the local network or the Internet, or in the absence of a response from the addressee. For example, it is quite often required to check the ping in relation to search engines. Often the comfort of online games depends on ping.

It is wise to check the ping to the game server before playing. Of course, the lower the ping, the more comfortable the network is.

Verifies an IP-level connection to another TCP / IP-capable computer by sending ICMP Echo Request messages. After each transmission, a corresponding message with an echo reply is displayed. Ping is a basic TCP / IP command used to troubleshoot a connection problem, verify accessibility, and resolve names. Team ping launched without parameters displays help.

Syntax

ping [-t] [-a] [-n counter] [-l the size] [-f] [-i TTL] [-v a type] [-r counter] [-s counter] [{-j node_list | -k node_list}] [-w interval] [target_name]

Parameters

-t Instructs the ping command to send ping messages to the destination until the command is interrupted. Press CTRL-BREAK to interrupt the command and display statistics. Press CTRL-C to interrupt and exit the ping command. -a Specifies reverse name resolution by destination IP address. If successful, the name of the corresponding node is displayed. -n counter Specifies the number of Echo Request messages to send. The default is 4. -l the size Specifies the length, in bytes, of the data field in sent echo request messages. The default is 32 bytes. Maximum the size 65527. -f Specifies that ping messages are sent with the "Don" t Fragment "flag in the IP header set to 1. Ping messages are not fragmented by routers on their way to their destination. with the maximum data unit for the channel (Maximum Transmission Unit). -i TTL Specifies the value of the TTL field in the IP header for outbound Echo Request messages. The default is the TTL that is the default for the host. For Windows XP hosts, this value is typically 128. The maximum value TTL 255. -v a type Specifies the value of the Type of Service (TOS) field in the IP header for Echo Request messages that are sent. By default, this value is 0. a type it is a decimal value between 0 and 255. -r counter Specifies the Record Route parameter in the IP header to record the path followed by the echo request message and its corresponding echo reply message. Each transition in a path uses a route entry parameter. If possible, the value counter set equal to or greater than the number of hops between source and destination. Parameter counter has a value from 1 to 9. -s counter Specifies an Internet Timestamp option in the IP header to record the arrival time of the Echo Request message and its corresponding Echo Reply message for each hop. Parameter counter has a value from 1 to 4. -j node_list Forces Echo Request messages to use the free routing option in the IP header with the set of intermediate destinations specified in node_list... With loose routing, successive intermediate destinations can be separated by one or more routers. The maximum number of addresses or names in a host list is 9. A host list is a set of IP addresses (in dotted decimal notation) separated by spaces. -k node_list Forces Echo Request messages to use the strict routing option in the IP header with the set of intermediate destinations specified in node_list... With strict routing, the next intermediate destination must be directly reachable (it must be adjacent on the router interface). The maximum number of addresses or names in a host list is 9. A host list is a set of IP addresses (in dotted decimal notation) separated by spaces. -w interval Specifies, in milliseconds, the time to wait for an Echo Reply message that matches the Echo Request message. If the echo reply message is not received within the specified interval, the error message "Request timed out" is issued. The default interval is 4000 (4 seconds). target_name Specifies the destination identified by the IP address or hostname. /? Displays command line help.

Notes (edit)

  • Team ping allows you to check the name and IP address of your computer. If the IP address check is successful and the name check is not, then there is a name resolution problem. In this case, use Domain Name System (DNS) queries or NetBIOS name resolution methods to verify that the target computer name is resolved in the local Hosts file.
  • This command is available only if in the properties of the network adapter in the object Network connections as a component is set internet protocol (TCP / IP).

Examples of

The example below contains the output of the command ping:

C: \> ping example.microsoft.com

Pinging example.microsoft.com with 32 bytes of data:

Reply from 192.168.239.132: bytes = 32 time = 100ms TTL = 124

Reply from 192.168.239.132: bytes = 32 time = 101ms TTL = 124

Reply from 192.168.239.132: bytes = 32 time = 101ms TTL = 124

To send a message to destination 10.0.99.221 and map to its hostname, enter:

ping -a 10.0.99.221

To send ten Echo Request messages to destination 10.0.99.221, each with a 1000 byte data field, enter:

ping -n 10 -l 1000 10.0.99.221

To send a message to destination 10.0.99.221 and record a route for 4 hops, enter:

ping -r 4 10.0.99.221

To send a message to the 10.0.99.221 destination and set free routing to the 10.12.0.1-10.29.3.1-10.1.44.1 destinations, enter:

ping -j 10.12.0.1 10.29.3.1 10.1.44.1 10.0.99.221

For questions, discussions, comments, suggestions, etc., you can use the forum section of this site (registration is required).

Updated: 07.01.2019 Published: 27.06.2016

Ping Command Options and Descriptions

General syntax:

ping [options]<имя сервера или IP-адрес>

Windows

To view on Windows also use the command ping /?

Used often:

Parameter Description
-t The command will constantly send requests for verification until it is interrupted with the Ctrl + C keys. It is convenient if the network is not working and in order not to constantly check if there is a connection.
-a Attempts to resolve the hostname through DNS.
-n Specifies the number of attempts to send a request.
-l Package size. It is used to check the stability of the network, create a test load, and so on.
-f By default, ping allows fragmentation, which means that a packet can be split into multiples to match the minimum throughput (MTU). This flag prohibits this. Used to determine the above mentioned MTU.
-i Sets the packet lifetime (the number of network devices through which the signal can pass). It can be used in cases where the amount of equipment is too large. You can also determine its quantity.
-w Sets the waiting time. It is used if there are performance problems on the network or the distance to the node is very long.
-S Allows you to perform a network check from a specific source. Can be used from a host with multiple NICs and sending a request from a specific one.
-4 Use IPv4 only.
-6 Use IPv6 only.

Rarely used

Examples of using

A simple example of using the ping command

An example answer with a good connection:

Packet exchange with yahoo.com with 32 bytes of data:

Reply from 206.190.36.45: bytes = 32 time = 191ms TTL = 47

An example of a response if the node is not available:

Packet exchange from yahoo.com with 32 bytes of data:

Timed out request.

* there is no signal to the remote node. There might be a problem with the network.

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

* unable to determine hostname. Possible problems: there is no connection with DNS, DNS is not working, the requested hostname does not exist.

Opening a Port for Ping

It is fair to say that not in all cases a failure to respond to a ping means that the remote host is unreachable. The resource administrator can intentionally disable responses to ping requests.

It is also important to know that ping does not use a specific port number. To open the ping option, you must either find the appropriate option (in many home routers) or enable ICMP (Internet Control Message Protocol) on the firewall. Well, or vice versa - to close the possibility of ping, we block ICMP requests.

Port check

You cannot use the ping command to test the openness of a particular port.

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 get more information about them, use the /? ...

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 is a great way to test all the functionality of Windows. But with the help of this request, it will not be possible to find out about the state of your own or a 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.

Tip: The number after the% sign in the responses generated in this example indicates the IPv6 Zone ID, which identifies the network gateway to use. You can generate a table from Zone IDs matching the name of your network gateway using netsh interface ipv6 show interface... IPv6 Zone ID is displayed as a number in the Idx column.

Ping command support

The ping command is supported on the command line of Windows 10, Windows 8, Windows 7, Windows Vista and Windows XP, and Windows 98 and 95.

If you have problems with the network, you need to find out the cause of the problem, and the Ping command, which can be run through the command line, can help with this.

The Ping command is not just a command, but a program included in the Windows operating systems. If you do not go into special subtleties, then the essence of its work is to send a request to a remote address and receive a response from it. If there is no answer, then the computer to which the request was sent is either turned off, or there is a malfunction of the network equipment or cable.

Let's take a look at the operation of this program, for this we run the command line ( Start \ Programs \ Accessories \ Run \ cmd)

And so, let's say we need to check the connection to a server or workstation on the network, for this we enter the ping command and the ip address or dns name of the computer with which we need to check the connection ( ping 192.168.0.3).

There are situations when the browser does not want to display the site and there may be a suspicion that the provider is doing its job poorly. However, the browser, like any program, may be buggy or simply not configured correctly, so you need to make sure that there is no Internet for a programmatic reason. To do this, we will "ping" or, as the common people say, we will "pass" some server on the Internet. And it is better to check the connection with the servers of large Internet companies such as Yandex, Google, Microsoft. Since for them, the unavailability of the server threatens the loss of millions, while the servers of other companies may be unavailable, and you will think that there is no Internet ( pingyandex.ru)

And so, what information does the ping command provide us with:

1) the IP address of the server - with which we are testing the connection " Exchange of packets with yandex.ru with 32 bytes of data". Those. The ip address of this server is 213.180.204.11.

2) Server response time- this time is determined from the moment the request is sent until the response is received and is measured in milliseconds. The lower the given value, the better the connection.

3) Number of nodes that passes the data packet until it reaches its destination. The TTL value tells us about this (in the decoding time to life or time to life). The work of this parameter is that as each node in the network (router) passes, the TTL value decreases by one, and thus you can find out how many nodes the packet has passed until it reaches its destination. It seems like the default TTL is 128, but in different operating systems in different ways.

But there is a simpler way to find out the number of nodes and the IP addresses of these nodes, through the command tracert yandex.ru.

By default, 4 packets are sent sequentially, and after they are sent, statistics are provided. The number of sent, received and lost packets, depending on these values, the percentage of losses is calculated. And also the approximate time of reception and transmission is calculated.

And so, what the data obtained after executing the ping command can tell us:

1) If you "ping" a computer in the local network and "pings" do not pass, then there are several reasons:

Incorrect configuration of the network connection;

Broken cable;

The remote computer is turned off;

Malfunctioning network equipment (local or remote network card, switch or router)

Or the packets are blocked by the firewall.

2) If you are checking the connection to the Internet, then the following reasons are possible:

Malfunction of the router (it happens that the router is buggy, so you should restart it and check the connection again);

The server of the site that you are "pinging" is unavailable, but as I said, it is better to "ping" the sites of large organizations, since they should be accessible anyway;

Fault at the provider. If sites do not "ping" and the external network indicator on the router does not light up, then most likely the provider, which provides access to the Internet, has problems. But it's not a fact, there can be many reasons: incorrect configuration of the router or software, cable breakage, poor contact between the cable and the network device, failure of network equipment or a network card. In general, all this needs to be checked.

The ping command also has many additional parameters, to find out which ones, just type the command ping /?, but I'll tell you about the ones that I use myself.

ping yandex.ru –t- this command will endlessly check the connection with the given node until you press Ctrl + C. This helps when there is no connection, and in order not to refresh the browser page, just enter the command and as soon as the "pings" go, the connection will appear.

ping –a 213.180.193.11- this command allows you to find out the DNS name of the computer by its ip address. Personally, I had a situation when one of the computers took a lot of Internet traffic, and only the ip address was known, and so this command allowed me to find the pest!

Top related articles