Windows provides the ping command in order to check remote system network connectivity. The ping name comes from the “Packet Internet Groper”. The ping command is provided by Windows operating systems by default. Ping command can send ICMP packets to the specified targets where the targets can be specified as IP address or hostname.
Open MS-DOS (cmd.exe)
The MS-DOS which is the command-line interface of the Windows operating systems. It is also called as cmd.exe. Because after providing the Windows operating systems with a desktop ad GUI the MS-DOS operating system is provided as an executable called cmd.exe and all MS-DOS commands can be executed via this command-line interface.
MS-DOS or cmd.exe can be opened in different ways. We can open the cmd.exe from the Start menu by typing the cmd or msdos or command prompt which will list the Command Prompt. The Command Prompt is another name of the cmd.exe.
Alternatively, the command line interface can be also opened from the Run where just type the cmd.exe and press the OK button or Enter key.
For more information about opening the command line interface or cmd please take a look at the following tutorial.
Display ping Command Help Information
Even the job of the ping tool is very simple it provides different parameters and options to configure the ping action. All of these features can be listed and displayed with the /? option like below. This will list options, parameters and their meanings line by line.
> ping /?
The output will be like below where the syntax of the ping command also provided.
Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] [-R] [-S srcaddr] [-c compartment] [-p] [-4] [-6] target_name Options: -t Ping the specified host until stopped. To see statistics and continue - type Control-Break; To stop - type Control-C. -a Resolve addresses to hostnames. -n count Number of echo requests to send. -l size Send buffer size. -f Set Don't Fragment flag in packet (IPv4-only). -i TTL Time To Live. -v TOS Type Of Service (IPv4-only. This setting has been deprecated and has no effect on the type of service field in the IP Header). -r count Record route for count hops (IPv4-only). -s count Timestamp for count hops (IPv4-only). -j host-list Loose source route along host-list (IPv4-only). -k host-list Strict source route along host-list (IPv4-only). -w timeout Timeout in milliseconds to wait for each reply. -R Use routing header to test reverse route also (IPv6-only). Per RFC 5095 the use of this routing header has been deprecated. Some systems may drop echo requests if this header is used. -S srcaddr Source address to use. -c compartment Routing compartment identifier. -p Ping a Hyper-V Network Virtualization provider address. -4 Force using IPv4. -6 Force using IPv6.
Ping IP Address
The ping command generally used to check given remote IP address network connectivity. The IP address can be IPv4 or IPv6. In the following example, we will ping the popular DNS service IP address which is 22.214.171.124 .
> ping 126.96.36.199
By default, the Windows ping commands send 4 ICMP packets which can be also called 4 ping packets to the target system. After 4 packets the ping command stops and provides information about the status of the packet, accessibility to the target system, etc. During the ping, every sent packet information also printed to the screen with some basic information.
We can see that there are 4 lines like below.
Reply from 188.8.131.52: bytes=32 time=38ms TTL=128
- Reply from 184.108.40.206 specifies the replying target system which returns ICMP responses.
- bytes=32 is the size of the ICMP packet
- time=38ms is the RTT or round trip time.
- TTL=128 is the TTL value for the ICMP packet.
The last lines provides general statistics about the ping.
The ping command can be also used to ping a hostname or domain name. But the DNS should be working properly and resolve the given domain name or hostname into an IP address. In the following example, we will ping the hostname www.windowstect.com .
> ping www.windowstect.com
The output will be like below where the hostname www.windowstect.com will be resolved into IP address 220.127.116.11 .
Set Packet Count
By default, the Windows ping command sends 4 ping packets or ICMP packets to the specified target. But in some cases, this may not enough and we may need to change the packet count for a longer test. We can specify the packet count with the -n option by providing the count we want. In the following example, we will send 10 ping or ICMP packets to the target. The -n is the short form of the number.
> ping -n 10 www.windowstect.com
By default, the Windows ping command only sends 4 ping or ICMP packets and then stops. But for the longer test, we may require to send a lot of packets which will be sent forever or unless we stop it. The continuous ping option can be used ping packets repetitively forever. The continuous ping option is -t and there is no need to specify the packet count.
> ping -t www.windowstect.com