Vous êtes sur la page 1sur 8

Ping command

Ping Command
Among the various measurement packages is the original PING (Packet
InterNet Groper) program used over the last six years for numerous tests and
measurements of the Internet system and its client nets. This program contains
facilities to send various kinds of probe packets, including ICMP Echo
messages, process the reply and record elapsed times and other information in a
data file, as well as produce real-time snapshot histograms and traces.

This program is intended for use in network testing, measurement and


management. It should be used primarily for manual fault isolation. Because of
the load it could impose on the network, it is unwise to use ping during normal
operations or from automated scripts...

The Internet Ping command bounces a small packet off a domain or IP address
to test network communications, and then tells how long the packet took to
make the round trip. The Ping command is one of the most commonly used
utilities on the Internet by both people and automated programs for conducting
the most basic network test: can your computer reach another computer on the
network, and if so how long does it take?

Every second of the day there are untold millions of pings flashing back and
forth between computers on the Internet like a continuous shower of electronic
neural sparks. The following subsections provide information onhow Ping was
invented, how Ping works, how to use Ping, Ping web sites, and info on the
original Unix Ping version.

How Ping was invented. The original PING command stood for "Packet Internet
Groper", and was a package of diagnostic utilities used by DARPApersonnel to
test the performance of the ARPANET. However, the modern Internet Ping
command refers to a program was written by Mike Muuss in December, 1983,
which has since become one of the most versatile and widely used diagnostic
tools on the Internet. Muuss named his program after the sonar sounds used for
echo-location by submarines and bats; just like in old movies about submarines,
sonar probes do sound something like a metallic "ping".

How Ping works. The Internet Ping program works much like a sonar echo-
location, sending a small packet of information containing
an ICMPECHO_REQUEST to a specified computer, which then sends an
ECHO_REPLY packet in return. The IP address 127.0.0.1 is set by convention
to always indicate your own computer. Therefore, a ping to that address will

Gpt karkala Page 1


Ping command

always ping yourself and the delay should be very short. This provides the most
basic test of your local communications.

How to use Ping. You can use the Ping command to perform several useful
Internet network diagnostic tests, such as the following:

 Access. You can use Ping to see if you can reach another computer. If
you can't ping a site at all, but you can ping other sites, then it's a pretty
good sign that your Internet network is fine and that site is down. On the
other hand, if you can't ping any site, then likely your entire network
connection is down -- try rebooting.

 Time & distance. You can use the Ping command to determine how long
it takes to bounce a packet off of another site, which tells you its Internet
distance in network terms. For example, a website hosted on your
neighbor's computer next door with a different Internet service provider
might go through more routers and be farther away in network distance
than a site on the other side of the ocean with a direct connection to the
Internet backbone.

If a site seems slow, you can compare ping distances to other Internet
sites to determine whether it is the site, the network, or your system that
is slow. You can also compare ping times to get an idea of which sites
have the fastest network access and would be most efficient for
downloading, chat, and other applications.

 Domain IP address. You can use the Ping command to probe either
adomain name or an IP address. If you ping a domain name, it helpfully
displays the corresponding IP address in the response.

You can run the ping command on a Windows computer by opening an


MSDOS window and then typing "ping" followed by the domain name or IP
address of the computer you wish to ping. You can list the available options for
the Windows ping command with "ping -?".

Online ping. If you can't use the Ping command from your own computer
because of a firewall or other restriction, or want to do an Internet ping from
another location than your own, you can use one of the following websites that
offer online ping services:

Gpt karkala Page 2


Ping command

 his.com Ping
 Network-Tools
 Spfld.com Ping

Remember when doing an online ping that the packets are sent from that
website, so the times that are returned reflect the path from that location and not
from your computer. Nevertheless, a ping from an online website can be useful
to test if an address can be reached from different places around the Internet, to
do comparative timing to test how long it takes to reach one site compared to
others.

If the times returned by several online ping sites to an Internet address are
consistently long, then the destination site's network is likely having problems.
On the other hand, if you can ping an address from an online ping site but not
from your own computer, then there is likely some block in your network
preventing you from communicating with that site.

Unix version. Muuss originally created the ping command for the Unixsystem,
with the options summarized below:

ping [-q] [-v] [-R] [-c Count] [-i Wait] [-s PacketSize] Host

Option Example Definition


ping -c ping -c 10 Specify the number of echo
count requests to send.
Ping -d ping -d Set the SO_DEBUG option.
Ping -f ping -f Flood ping. Sends another echo
request immediately after receiving
a reply to the last one. Only the
super-user can use this option.
Ping host ping Specify the host name (or IP
121.4.3.2 address) of computer to ping
ping -i ping -i 2 Wait time. The number of seconds
wait to wait between each ping
ping -l ping -l 4 Sends "preload" packets one after
preload another.
Ping -n ping -n Numeric output, without host to
symbolic name lookup.

Gpt karkala Page 3


Ping command

Ping -p ping -p Ping Pattern. The example sends


pattern ff00 two bytes, one filled with ones, and
one with zeros.
Ping -q ping -q Quiet output. Only summary lines
at startup and completion
ping -r ping -r Direct Ping. Send to a host directly,
without using routing tables.
Returns an error if the host is not
on a directly attached network.
Ping -R Ping -R Record Route. Turns on route
recording for the Echo Request
packets, and display the route
buffer on returned packets (ignored
by many routers).
ping -s ping -s 10 Sets the packet size in number of
PacketSize bytes, which will result in a total
packet size of PacketSize plus 8
extra bytes for the ICMP header
ping -v ping -v Verbose Output. Lists individual
ICMP packets, as well as Echo
Responses

Gpt karkala Page 4


Ping command

The ping command is a Command Prompt command used to test the


ability of the source computer to reach a specified destination computer. The
ping command is usually used as a simple way verify that a computer can
communicate over the network with another computer or network device.

The ping command operates by sending Internet Control Message Protocol


(ICMP) Echo Request messages to the destination computer and waiting for a
response.

How many of those responses are returned, and how long it takes for them to
return, are the two major pieces of information that the ping command provides.

Note: The ping command is often used with other networking related Command
Prompt commands like tracert, ipconfig, netstat, nslookup, and others.

Ping Command Availability

The ping command is available from within the Command Prompt in Windows
10,Windows 8, Windows 7, Windows Vista, and Windows XP operating
systems. The ping command is also available in older versions of Windows like
Windows 98 and 95.

The ping command can also be found in Command Prompt in the Advanced
Startup Options and System Recovery Options repair/recovery menus.

Note: The availability of certain ping command switches and other ping
commandsyntax might differ from operating system to operating system.

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 [/?]

Tip: See How to Read Command Syntax if you're not sure how to interpret the
ping command syntax above or described in the table below.

-t Using this option will ping the target until you force it to stop
using Ctrl-C.

Gpt karkala Page 5


Ping command

-a This ping command option will resolve, if possible,


the hostnameof an IP address target.

-n count This 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 size Use 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.

-f Use 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 TTL This option sets the Time to Live (TTL) value, the maximum of
which is 255.

-v TOS This 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 count Use this ping command option to specify the number


of hopsbetween your computer and the target computer or
device that you'd like to be recorded and displayed. The
maximum value forcount is 9, so use the tracert
command instead if you're interested in viewing all the hops
between two devices.

-s count Use 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 timeout Specifying 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.

-R This option tells the ping command to trace the round trip path.

Gpt karkala Page 6


Ping command

-S Use this option to specify the source address.

-p Use this switch to ping a Hyper-V Network


Virtualization provider address.

-4 This forces the ping command to use IPv4 only but is only
necessary if target is a hostname and not an IP address.

-6 This forces the ping command to use IPv6 only but as with the -
4option, is only necessary when pinging a hostname.

target This 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.

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

Other less commonly used switches for the ping command exist including [-
j host-list], [-k host-list], and [-c compartment]. Execute ping /? from the
Command Prompt for more information on these two options.

Tip: Save all of the ping command output to a file using a redirection operator.
SeeHow to Redirect Command Output to a File for instructions or see
our Command Prompt Tricks list for more tips.

Ping Command Examples


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

In this example, the ping command is used to ping the


hostname www.google.com. The -n option tells the ping command to
send 5 ICMP Echo Requests instead of the default of 4, and the -l option sets
the packet size for each request to 1500 bytes instead of the default of 32 bytes.

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

Pinging www.google.com [74.125.224.82] with 1500 bytes of data:


Reply from 74.125.224.82: bytes=1500 time=68ms TTL=52

Gpt karkala Page 7


Ping command

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 reported under Ping statistics for 74.125.224.82 tells me that each
ICMP Echo Request message sent to www.google.com was returned. This
means that, as far as my network connection goes, I can communicate with
Google's website just fine.

ping 127.0.0.1

In the above example, I'm pinging 127.0.0.1, also called the IPv4 localhost IP
address or IPv4 loopback IP address, without options.

Using the ping command to ping 127.0.0.1 is an excellent way to test that
Windows' network features are working properly but it says nothing about your
own networkhardware or your connection to any other computer or device.

The IPv6 version of this test would be ping ::1.

ping -a 192.168.1.22

In this example I'm asking the ping command to find the hostname assigned to
the192.168.1.22 IP address, but to otherwise ping it as normal.

Pinging J3RTY22 [192.168.1.22] with 32 bytes of data:


Reply from 192.168.1.22: bytes=32 time

As you can see, the ping command resolved the IP address I


entered, 192.168.1.22, as the hostname J3RTY22, and then executed the
remainder of the ping with default settings.

ping -t -6 SERVER

Gpt karkala Page 8

Vous aimerez peut-être aussi