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
Example5-9 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,check the status of the network that is reported by the ipadm andnetstat commands. Refer to Monitoring IP Interfaces and Addresses in Oracle Solaris Administration: Network Interfaces and Network Virtualization and Monitoring Network Status With the netstat Command.
Copyright © 1999, 2012, Oracle and/or its affiliates. All rights reserved. Legal Notices |