C.2 Using ping to Test the Reachability

   


C.2 Using ping to Test the Reachability

ping is the first tool generally used when a computer is not reachable, to check the network connection. ping sends an ECHO_REQUEST packet to the specified computer and expects an ECHO_REPLY. (See Section 24.4.) In addition, ping outputs statistical values about the connection. It is also possible to use the IP option record route to track the route of packets.

Syntax

ping [-DdfLnqRrv] [-c number] [-I address] [-i time]        [-l number] [-p pattern] [-s size] [-t ttl] [-w time]        computer

ping has the following options:

  • -c number: ping sends only number packets, then terminates. Normally, ping runs forever until the process is stopped.

  • -f runs a so-called flood ping. This means that ping sends as many packets as it received replies, or at least a hundred per second. This option can be used to check the behavior of a network or end system under high load.

  • -I address specifies the network device (by the IP address) that should be used to send echo packets.

  • -i time specifies the wait time between two sent echo request packets. This value is normally one second.

  • -l number sends number packets at maximum speed. Subsequently, ping switches into the normal transmit mode.

  • -n prevents the resolution and output of DNS names. IP addresses are written in dotted decimal notation.

  • -p pattern fills sent echo packets with the specified pattern. This allows you to check the behavior of packets with certain contents.

  • -q is the quiet mode, which outputs statistics only when the program is closed.

  • -R enables the IP option record route. (See Section 14.4.) It outputs all routers visited, if these routers support the record route option.

  • -s size sets the ICMP packet to size bytes. Normally, an echo packet is of size 56 bytes. Together with the ICMP header (8 bytes), the size is then 64 bytes.

  • -t ttl sets the value of the Time-To-Live field in the packet header to ttl, which allows you to limit the reach of an echo request.

  • -w time sets the maximum wait time for a reply to an echo request to time seconds. The normal wait time for an outstanding reply to an echo request is ten seconds.

Example

root@tux # ping www.Linux-netzwerkarchitektur.de PING www.Linux-netzwerkarchitektur.de (192.67.198.52): 56 data bytes 64 bytes from 192.67.198.52: icmp_seq=0 ttl=246 time=4.589 ms 64 bytes from 192.67.198.52: icmp_seq=1 ttl=246 time=3.481 ms 64 bytes from 192.67.198.52: icmp_seq=2 ttl=246 time=3.271 ms 64 bytes from 192.67.198.52: icmp_seq=3 ttl=246 time=3.785 ms --- www.Linux-netzwerkarchitektur.de ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round trip min/avg/max = 3.271/3.781/4.589 ms


       


    Linux Network Architecture
    Linux Network Architecture
    ISBN: 131777203
    EAN: N/A
    Year: 2004
    Pages: 187

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net