Ping
Ping
Why Do Techies
Tell Me to “Ping”
a Website?
1-800-COURSES www.globalknowledge.com
Why Do Techies Tell Me to “Ping”
a Website?
Paul Simoneau, Global Knowledge Senior Instructor and Course Director
Introduction
Great question! Let’s start by dividing the answer into three parts:
• A better understanding of ping
• How to ping
• Learning from pinging a system
The ping command tells ICMP to send an echo request. By default, that is a relatively small message. It goes out to a
destination to verify that the sender can reach the target device. In normal operation, the system that receives that
request will respond with an echo reply.
Those messages have specific contents for their assigned purpose. There are three fields that ping uses by default.
The first contains an ID number to identify each new ping command issued by the operating system. The second
field carries a sequence number to separately identify which of multiple request/reply combinations is being
processed. The third field is the ICMP checksum to make sure the data sent is the data received.
Both messages will normally have identical data fields. By default, the operating system will set the number of bytes
in the field from 32 bytes to 128 bytes, depending on the system. The ping command also lets the user set the
number of bytes to be echoed, which is called an override. That can be as many as the IP datagram maximum of
65,535 bytes, minus the IP header and ICMP header (or approximately 65,500 bytes).
The ping command lets the user set a flag and designate the number of pings at a specific number or use another
flag to tell the system to ping until interrupted by a Control-C key combination. It also lets the user separately set a
flag that will request a translation from a target IP address to a host and domain name that matches that numeric
address.
How to Ping
While IP and ping are standardized, the commands that each operating system (Windows, Linux, Mac) uses to send
ping with options will be different.
With many people using XP or XP Pro, we will examine those commands first. As a starting point, you can look up
the possible choices by going to the command prompt and typing: ping /?
• -t: Specifies that ping continue sending echo request messages to the destination until interrupted. To
interrupt and display statistics, press CTRL-BREAK. To interrupt and quit ping, press CTRL-C.
• -a: Specifies that reverse name resolution is performed on the destination IP address. If this is successful,
ping displays the corresponding host name.
• -n Count: Specifies the number of echo request messages sent. The default is four.
• -l Size: Specifies the length, in bytes, of the data field in the echo request messages sent. The default is 32.
The maximum size is 65,527.
• -f: Specifies that echo request messages are sent with the “Don't Fragment” flag in the IP header set to 1.
The echo request message is not to be fragmented by routers in the path to the destination. This
parameter is useful for troubleshooting Path Maximum Transmission Unit (PMTU) problems.
• -i TTL: Specifies the value of the TTL field in the IP header for echo request messages sent. The default is the
default TTL value for the host. For Windows XP hosts, this is typically 128. The maximum TTL is 255.
• -v TOS: Specifies the value of the Type of Service (ToS) field in the IP header for echo request messages
sent. The default is zero. TOS is specified as a decimal value from zero to 255.
ping www.globalknowledge.com
Pinging www.globalknowledge.com [192.168.111.222] with 32 bytes of data:
ping -s [-d] [-l] [-L] [-n] [-r] [-R] [-v] [ -i interface_address ] [-I interval] [-t ttl] host [packetsize] [count]
ping google.com –c 1
Ping the host google.com once and return to the command line with a response similar to this:
ping [-AaCDdfnoQqRrv] [-b boundif] [-c count] [-G sweepmaxsize] [-g sweepminsize] [-h sweepincrsize] [-i wait] [-l
preload] [-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr] [-s packetsize] [-t timeout] [-W waittime] [-z
tos] host
ping [-AaDdfLnoQqRrv] [-b boundif] [-c count] [-I iface] [-i wait] [-l preload] [-M mask | time] [-m ttl] [-P policy] [-p
pattern] [-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-W waittime] [-z tos] mcast-group
• -A: Audible. Output a bell (ASCII 0x07) character when no packet is received before the next packet is
transmitted. To cater for round-trip times that are longer than the interval between transmissions, further
missing packets cause a bell only if the maximum number of unreceived packets has increased.
• -a: Audible. Include a bell (ASCII 0x07) character in the output when any packet is received. This option is
ignored if other format options are present.
• -b boundif: Bind the socket to interface boundif for sending.
• -C: Prohibit the socket from using the cellular network interface.
• -c count: Stop after sending (and receiving) count ECHO_RESPONSE packets. If this option is not specified,
ping will operate until interrupted. If this option is specified in conjunction with ping sweeps, each sweep
will consist of count packets.
• -D: Set the Don't Fragment bit.
• -d: Set the SO_DEBUG option on the socket being used.
• -f: Flood ping. Outputs packets as fast as they come back or one hundred times per second, whichever is
more. For every ECHO_REQUEST sent a period “.'' is printed, while for every ECHO_REPLY received a
backspace is printed. This provides a rapid display of how many packets are being dropped. Only the super
user may use this option. This can be very hard on a network and should be used with caution.
• -G sweepmaxsize: Specify the maximum size of ICMP payload when sending sweeping pings. This option is
required for ping sweeps.
• -g sweepminsize: Specify the size of ICMP payload to start with when sending sweeping pings. The default
value is 0.
• -h sweepincrsize: Specify the number of bytes to increment the size of ICMP payload after each sweep
when sending sweeping pings. The default value is 1.
• -I iface: Source multicast packets with the given interface address. This flag only applies if the ping
destination is a multicast address.
• -i wait: The wait number of seconds between sending each packet. The default is to wait for one second
between each packet. The wait time may be fractional, but only the super-user may specify values less than
0.1 second. This option is incompatible with the -f option.
• -L: Suppress loopback of multicast packets. This flag only applies if the ping destination is a multicast
address.
• -l preload: If preload is specified, ping sends that many packets as fast as possible before falling into its
normal mode of behavior. Only the superuser may use this option.
ping 127.0.0.1 will make sure your system’s network components work.
ping default gateway IP address will ensure you can reach systems on your local network including your
router/gateway. To find your network gateway address, use the command route print in Windows and route –n in
Linux and route –n get default in OS X.
ping by name will verify that the domain name system is working correctly. It will also return the IP address for
that name.
Some popular sites like amazon.com, microsoft.com, slashdot.org, and others that have had Denial of Service (DoS)
attacks in the past often disable ICMP echo requests and responses on their servers or setup other network settings
that stop a ping request from being received or block a response.
When you ping these domain names or their matching IP addresses you'll get a "Request timed out" message or a
"100% packet loss" message (sometimes both). This is normal behavior for these sites and there is nothing that can
be done to get around it.
When you ping, your system calculates round-trip times and packet loss statistics. For example, here is a Windows
summary:
Request timedout.
Reply from 192.168.111.222: bytes=32 time=101ms TTL=124
Reply from 192.168.111.222: bytes=32 time=120ms TTL=124
Reply from 192.168.111.222: bytes=32 time=120ms TTL=124
“time=101ms” indicates the round trip time for that ping. If the times seem to be large for a known path, it could
be telling us that the network is congested.
“TTL=124” tells us that, to reach the target, the ping had to pass through four routers on its way (128-124 = 4) as
each router subtracts one count from the IP TTL value.
To test response times on a local network, we may use ping –r 9 (destination) to record the path up to nine routers.
If you think it may be more than nine routers away, use the command tracert (destination) on Windows systems or
traceroute (destination) on Linux or OS X. traceroute uses different protocols than ICMP to accomplish a very
similar result as tracert. The tracert command is the equivalent of the following series of commands:
ping -n 3 -i 1 destination
ping -n 3 -i 2 destination
ping -n 3 -i 3 destination
.
.
.
ping -n 3 -i 28 destination
ping -n 3 -i 29 destination
ping -n 3 -i 30 destination
A successful tracert will show a return a result similar to this example: tracert 11.1.0.1
Trace complete.
If the times return a series of entries like 8, 9, and 10 (as shown below), it indicates that the organization supporting
those routers has decided to ignore ICMP messages to protect their networks from potential attacks. The others (at
11 and 12) have chosen to support ICMP or have left the default in place.
8 * * *
9 * * *
10 * * *
11 82 ms 83 ms 82 ms 66.208.233.50
12 97 ms 93 ms 91 ms 216.6.87.158
We examined the details of the commands and flags, and how those flags vary from one operating system to
another. Although the flags are different, the work being done toward troubleshooting is the same. Of course,
some systems ignore some of those flags or have been hardened to secure and protect the networks they access.
Lastly, we looked at some ways to use ping and the related functions for troubleshooting networks. We showed
default values and how to bypass some of them. We also included what technical people (including knowledgeable
users) can learn from reading the results of pinging a system, which helps them (and us) solve connectivity
challenges.
Learn More
Learn more about how you can improve productivity, enhance efficiency, and sharpen your competitive edge
through training.
IPv6 Foundations: Protocols, Services, and Migration
Understanding Networking Fundamentals
TCP/IP Networking
He is a senior instructor and course director with Global Knowledge, the blended solutions training company. In that
role, he has authored and managed three highly successful courses: Understanding Network Fundamentals, Hands-
On Internetworking with TCP/IP, and Network Management with SNMP. These courses are offered worldwide in
classroom, virtual classroom, and self-directed formats. In support of these and other courses, he actively
participates in Global Knowledge’s e-mentoring programs.
His writing is also recognized outside of Global Knowledge in the “Hands-On TCP/IP” and “SNMP Network
Management” books that are published by McGraw-Hill.
A graduate of the State University of New York at Albany, he also holds a master’s degree from Webster University.