Probing Remote Hosts With the ping Command (2024)

Probing Remote Hosts With the ping Command

You can use the ping command to determine the status of a remotehost. When you run ping, the ICMP protocol sends a datagram to thehost that you specify, asking for a response. ICMP is the protocol responsiblefor error handling on a TCP/IP network. When you use ping, you canfind out whether an IP connection exists for the specified remote host.

The following is the basic syntax of ping:

/usr/sbin/ping host [timeout]

In this syntax, host is the name of the remote host. Theoptional timeout argument indicates the time in seconds for the ping command tocontinue trying to reach the remote host. The default is 20 seconds. Foradditional syntax and options, refer to the ping(1M) man page.

How to Determine if a Remote Host Is Running

  • Type the following form of the ping command:
    $ ping hostname

    If host hostname is accepting ICMP transmissions, this message is displayed:

    hostname is alive

    This message indicates that hostname responded to the ICMP request. However, if hostnameis down or cannot receive the ICMP packets, you receive the following responsefrom the ping command:

    no answer from hostname

How to Determine if a Host Is Dropping Packets

Use the -s option of the ping command to determine if a remotehost is running but nevertheless losing packets.

  • Type the following form of the ping command:
    $ ping -s hostname

Example8-13 ping Output for Detecting Packet Dropping

The ping -s hostname command continually sends packets to the specified host until yousend an interrupt character or a time out occurs. The responses on yourscreen resemble the following:

& ping -s host1.domain8PING host1.domain8 : 56 data bytes64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=0. time=1.67 ms64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=1. time=1.02 ms64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=2. time=0.986 ms64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=3. time=0.921 ms64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=4. time=1.16 ms64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=5. time=1.00 ms64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=5. time=1.980 ms^C----host1.domain8 PING Statistics----7 packets transmitted, 7 packets received, 0% packet lossround-trip (ms) min/avg/max/stddev = 0.921/1.11/1.67/0.26

The packet-loss statistic indicates whether the host has dropped packets. If ping fails, checkthe status of the network that is reported by the ifconfig andnetstat commands. Refer to Monitoring the Interface Configuration With the ifconfig Command and Monitoring Network Status With the netstat Command.

Copyright © 1999, 2010, Oracle and/or its affiliates. All rights reserved. Legal Notices

Probing Remote Hosts With the ping Command (1)Probing Remote Hosts With the ping Command (2)
Probing Remote Hosts With the ping Command (2024)
Top Articles
Latest Posts
Article information

Author: Madonna Wisozk

Last Updated:

Views: 5645

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Madonna Wisozk

Birthday: 2001-02-23

Address: 656 Gerhold Summit, Sidneyberg, FL 78179-2512

Phone: +6742282696652

Job: Customer Banking Liaison

Hobby: Flower arranging, Yo-yoing, Tai chi, Rowing, Macrame, Urban exploration, Knife making

Introduction: My name is Madonna Wisozk, I am a attractive, healthy, thoughtful, faithful, open, vivacious, zany person who loves writing and wants to share my knowledge and understanding with you.