theshell.ch/site/pages/cmd/interm/ping.html
bevilj af40908294 order pages for navigation
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@254 a672b425-5310-4d7a-af5c-997e18724b81
2018-11-18 20:38:56 +00:00

99 lines
4.1 KiB
HTML

---
layout: page
category-page: intermediate
category-title: Intermediate commands
author: Joy Albertini
tags: server ping latency
title: ping
previous-page: pages/cmd/interm/passwd.html
next-page: pages/cmd/interm/ps.html
---
The <code>ping</code> command, is used to test connection between a <b>local server/computer</b>
to a <b>remote UNIX server</b>.<br>
The ping command sends <b>ICMP Echo Request packets</b> to the remote server for accessing it.
Each <b>packet echoed back </b> (via an ICMP Echo Response packet) is written to the shell output.
<pre>
ping [-flag] server
</pre>
The main usages for the <code>ping</code> command are:
<ol>
<li>Test whether remote server if working.</li>
<li>Check the network connectivity from your local machine to a remote one.</li>
<li>Check for general network issues.</li>
</ol>
<pre>
ping theshell.ch
</pre>
The shell will output something like this:
<i>64 bytes from 98.138.219.232: icmp_seq=0 ttl=49 time=144.781 ms</i> for each packet
that returns (echoed back).<br>
To stop the ping command press <code>control + c</code>.
<h3>Flags</h3>
<ul>
<li><b>-c</b>: send limited number of packets with ping -c (nr of packets)<br>
Example: ping -c 4 yahoo.com, the shell will display the first 4 packets returned,
and then stop.
</li>
<li><b>-n</b>: avoid dns lookup, avoid to lookup symbolic names for host addresses,
so only numeric output.
</li>
<li><b>-a</b>: get an audio warning, when the remote server comes online <br>
Example: ping -a yahoo.com, server comes online audio signal for every
packets that returns.
</li>
<li><b>-b</b>: Allow pinging a broadcast address (broadcast network, is a network
with many devices on it).
</li>
<li><b>-m</b>: (mark) tag the packets going out.</li>
<li><b>-f</b>: (Flood ping) For every ECHO_REQUEST sent (.) is printed,
for every ECHO_REPLY received, a backspace is printed.
With this command you can easily understand how many packets are being dropped.
</li>
<li><b>-i</b>: (interval) set the interval between seending each packet (default 1 second);
only super-user can set interval values less than 0.2 seconds.
</li>
<li><b>-I</b>: (interface-address) set souce adress to a specific interface adress,
example the name of the device or IP. When pinging local adresses IPV6, is a needed flag.
</li>
<li><b>-l</b>: (preload) ping send packets but don't wait for reply.
Admin permissions are required to use this flag.
</li>
<li><b>-L</b>: Remove loopback of multicast packets.</li>
<li><b>-N</b>: (Nioption) send ICMpv6 request, instead of Echo requests
<ul>
<li><b>ipv6</b>: request Ipv6 adresses.</li>
<li><b>ipv4-all</b>: request Ipv4 adresses.</li>
</ul>
</li>
<li><b>-p</b>: (pattern) specify up to 16 number to fill out the packets sent.</li>
<li><b>-D</b>: print timestamp (unix time + microseconds) in each line.</li>
<li><b>-q</b>: (Quiet output) Nothing displayed except the summary lines at the start
and at the end.
</li>
<li><b>-R</b>: (Record route), displays the route buffer on the packets that include
RECORD_ROUTE in the ECHO_REQUEST.
</li>
<li><b>-r</b>: bypass the normal routing in a directly-attached network.</li>
<li><b>-s</b>: (packetsize) Specifies the data bytes to send (default is 56 that
+ 8 byte of ICMP = 64 ICMP data bytes).
</li>
<li><b>-t</b>: set IP time-to-live (set how long execute ping in seconds).</li>
<li><b>-U</b>: print full user-to-user latency (legacy ping behaviour).</li>
<li><b>-v</b>: output verbose on output</li>
<li><b>-V</b>: Display verion of command</li>
<li><b>-w</b>: (deadline) Timeout in seconds of ping command, regardless of how\
many packets have been sent.
</li>
<li><b>-W</b>: (timeout), time waiting for a response from the server, if the server
dosen't reply in the time set, the ping command will stop.
</li>
</ul>