Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ping - send echo requests to network hosts

&pagelevel(4)&pagelevel

The ping command tests whether network components can be reached.

The command uses the ICMP or ICMPv6 protocol. It sends echo requests packets to specific network components to determine whether or not they can be reached via the network. These network components reply by returning echo reply packets.


Syntax


ping [-nv] host [timeout]
ping -s[nv] host [packetsize [packetcount]]
ping -l host

host

Specifies the network component using the (FQDN) name, IPv4 address or IPv6 address.

-n

The host address is displayed instead of the host name.

-v

Verbose mode; when certain errors occur, additional messages are output.

-s

Statistics display (1 echo request per second); the following information is displayed:

  • time until the network component replies,

  • size of the various data packets,

  • number of data packets sent, received and lost,

  • the shortest, longest and average reply times.

-l

Outputs all the host’s IPv4 and IPv6 addresses (lookup).

packetsize

Size of the packet to be sent (default: 56 bytes, mnimum: 24 bytes, maximum: 1400 bytes); 8 bytes are added to the size for the header.

packetcount

Number of packets to be sent; by default (packetcount = 0) as many bytes as necessary are sent until the ping command is interrupted by the SIGINT signal.

timeout

Defines how long ping is to send new queries or to wait for an answer (default: 20 seconds).

Example 1

Successful ping call:

$ ping linux6

linux6 is alive

$

Example 2

Successful ping calls to an IPv4 address and to an IPv6 address with the -s option (packet size 72 bytes, 4 packets):

$ ping -s linux4 72 4

PING linux4: 72 data bytes

80 bytes from linux4 (172.17.29.15): icmp_seq=1 time=448.067 ms

80 bytes from linux4 (172.17.29.15): icmp_seq=2 time=33.339 ms

80 bytes from linux4 (172.17.29.15): icmp_seq=3 time=2.368 ms

80 bytes from linux4 (172.17.29.15): icmp_seq=4 time=2.834 ms

----linux4 PING Statistics----

4 packets transmitted, 4 packets received, 0% packet loss

round-trip (ms)  min/avg/max = 2.368/121.652/448.067

$

$ ping -s linux6 72 4

PING linux6: 72 data bytes

80 bytes from linux6 (3ffe:1:1001:3000:230:5ff:fefb:54e7): icmp_seq=1

time=3.690 ms

80 bytes from linux6 (3ffe:1:1001:3000:230:5ff:fefb:54e7): icmp_seq=2

time=3.222 ms

80 bytes from linux6 (3ffe:1:1001:3000:230:5ff:fefb:54e7): icmp_seq=3

time=3.285 ms

80 bytes from linux6 (3ffe:1:1001:3000:230:5ff:fefb:54e7): icmp_seq=4

time=3.197 ms

----linux6 PING Statistics----

4 packets transmitted, 4 packets received, 0% packet loss

round-trip (ms)  min/avg/max = 3.197/3.348/3.690

$

Example 3

ping call to a host which does not answer

$ ping test

no answer from test.region.example.net

used IPv4 address:      172.25.92.53
$

Example 4

ping call to a host which does not exist

$ ping inexist.region.example.net

ping: unknown host inexist.region.example.net

$

Example 5

ping call to a host which does not answer. If any exist, alternative IPv4/IPv6 addresses are displayed at which the host can possibly be reached:

$ ping www.ct.de

ping: sendto: No route to host

used IPv6 address:      2a02:2e0:3fe:100::8
alternate addresses:

        193.99.144.80        (IPv4)

$

Example 6

ping call to determine the IP addresses of a host

$ ping -l www.ct.de

hostname: www.ct.de

        IPv6 address:   2a02:2e0:3fe:100::8

        IPv4 address:   193.99.144.80
$