ping


Definition of PING (Packet Internet Groper) in Network Encyclopedia.

What is Ping?

PING stands for Packet Internet Groper, a TCP/IP utility that verifies the integrity of a network connection with a host on a TCP/IP network. The ping command is one of the first commands to use to troubleshoot communication problems on a TCP/IP network.

ping command - Packet Internet Groper
ping

How It Works

At the command prompt, type ping followed by either the IP address or the fully qualified domain name (if the Domain Name System is implemented) of the host for which you want to test networking connectivity. One or multiple Internet Control Message Protocol (ICMP) echo packets are sent to the host, and if connectivity is working, an equal number of echo replies are received. The replies show the packet size in bytes, response time in milliseconds, and Time to Live (TTL) of the echo reply.

The TTL is decremented for each hop along the way and indicates the number of routers (hops) passed through along the network path.

The usual procedure for using ping to troubleshoot a TCP/IP network follows:

  • Verify that TCP/IP is installed and running by pinging the local loopback address using ping 127.0.0.1.
  • Ping your own IP address and host name.
  • Ping the IP address of the default gateway for your local network.
  • Ping the IP address of a host on a remote network.

If these steps produce the expected results, TCP/IP is installed and running on your network.

This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

Ping /?

For advanced syntax features, simply type ping instead of ping /?.

Ping Command Options

ItemExplanation
-tUsing this option will ping the target until you force it to stop by using Ctrl-C.
-aThis ping command option will resolve, if possible, the host name of an IP address target.
-n countThis option sets the number of ICMP Echo Requests to send, from 1 to 4294967295. The ping command will send 4 by default if -n isn’t used.
-l sizeUse this option to set the size, in bytes, of the echo request packet from 32 to 65,527. The ping command will send a 32-byte echo request if you don’t use the -l option.
-fUse this ping command option to prevent ICMP Echo Requests from being fragmented by routers between you and the target. The -f option is most often used to troubleshoot Path Maximum Transmission Unit (PMTU) issues.
-i TTLThis option sets the Time to Live (TTL) value, the maximum of which is 255.
-v TOSThis option allows you to set a Type of Service (TOS) value. Beginning in Windows 7, this option no longer functions but still exists for compatibility reasons.
-r countUse this ping command option to specify the number of hops between your computer and the target computer or device that you’d like to be recorded and displayed. The maximum value for count is 9, so use the tracert command instead if you’re interested in viewing all the hops between two devices.
-s countUse this option to report the time, in Internet Timestamp format, that each echo request is received and echo reply is sent. The maximum value for count is 4, meaning that only the first four hops can be time stamped.
-w timeoutSpecifying a timeout value when executing the ping command adjusts the amount of time, in milliseconds, that ping waits for each reply. If you don’t use the -w option, the default timeout value of 4000 is used, which is 4 seconds.
-RThis option tells the ping command to trace the round trip path.
-S srcaddrUse this option to specify the source address.
-pUse this switch to ping a Hyper-V Network Virtualization provider address.
-4This forces the ping command to use IPv4 only but is only necessary if target is a hostname and not an IP address.
-6This forces the ping command to use IPv6 only but as with the -4 option, is only necessary when pinging a hostname.
targetThis is the destination you wish to ping, either an IP address or a hostname.
/?Use the help switch with the ping command to show detailed help about the command’s several options.

Additional information about PING options: The -f-v-r-s-j, and -k options work when pinging IPv4 addresses only. The -R and -S options only work with IPv6.

Ping Command Examples

ping -n 7 -l 2000 www.google.com

In this example, the ping command is used to ping the host name www.google.com. The -n option tells the ping command to send 7 ICMP Echo Requests instead of the default of 4, and the -l option sets the packet size for each request to 1000 bytes instead of the default of 32 bytes.

The result displayed in the Command Prompt window will look something like this:

Reply from 216.58.211.36: bytes=1000 time=21ms TTL=55
Reply from 216.58.211.36: bytes=1000 time=20ms TTL=55
Reply from 216.58.211.36: bytes=1000 time=20ms TTL=55
Reply from 216.58.211.36: bytes=1000 time=21ms TTL=55
Reply from 216.58.211.36: bytes=1000 time=20ms TTL=55
Reply from 216.58.211.36: bytes=1000 time=20ms TTL=55 
Reply from 216.58.211.36: bytes=1000 time=21ms TTL=55 
Ping statistics for 216.58.211.36: Packets: Sent = 7, Received = 7, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 29ms, Maximum = 31ms, Average = 30ms

The 0% loss reported under Ping statistics for 74.217.1.142 explains that each ICMP Echo Request message sent to www.google.com was returned. This means that, as far as this network connection goes, it can communicate with Google’s website just fine.

ping -t www.facebook.com

In this example, the ping command is used to ping the host name www.facebook.com with the -t option. This option will keep the ping active until Control-C is pressed to stop it.

Reply from 31.13.83.36: bytes=32 time=22ms TTL=57
Reply from 31.13.83.36: bytes=32 time=20ms TTL=57
Reply from 31.13.83.36: bytes=32 time=20ms TTL=57
Reply from 31.13.83.36: bytes=32 time=20ms TTL=57
Reply from 31.13.83.36: bytes=32 time=24ms TTL=57 
Reply from 31.13.83.36: bytes=32 time=23ms TTL=57 
Reply from 31.13.83.36: bytes=32 time=20ms TTL=57
Reply from 31.13.83.36: bytes=32 time=20ms TTL=57 
Ping statistics for 31.13.83.36: Packets: Sent = 8, Received = 8, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 20ms, Maximum = 24ms, Average = 21ms
Control-C
^C

Ping Security issues

To conduct a denial-of-service attack, an attacker may send ping requests as fast as possible, possibly overwhelming the victim with ICMP echo requests. This technique is called a ping flood.

Ping requests to multiple addresses, ping sweeps, may be used to obtain a list of all hosts on a network.

Troubleshoot with Ping

If you can ping a host’s IP address but not its fully qualified domain name (FQDN), you probably have a name resolution problem. Check your Domain Name System (DNS) configuration and make sure that the DNS server is running, or check your Hosts file if it is implemented.

Editor

Articles posted after being checked by editors.

Recent Posts