You can use the ping command to determine whether your system can communicate with a remote host. When you run the ping command, the ICMP protocol sends a datagram to the host that you specify, asking for a response. ICMP is the protocol that is responsible for error handling on a TCP/IP network. When you use the ping command, you can determine whether IP packets can be exchanged between your host and a specified remote host.
/usr/sbin/ping host [timeout]
where host is the name of the remote host. The optional timeout argument indicates the time (in seconds) for the ping command to continue trying to reach the remote host. The default is 20 seconds. For more information, see the ping(1M) man page.
The ping command can use both IPv4 and IPv6 protocols to probe target systems. Protocol selection depends on the addresses that are returned by the name server for the specific target ystem. By default, if the name server returns an IPv6 address for the target system, the ping command uses the IPv6 protocol. If the server returns only an IPv4 address, the ping command uses the IPv4 protocol. You can override this behavior by using the –A option to specify which protocol to use.
For detailed information, see the ping(1M) man page.
To determine if a remote system is reachable, use the ping command as follows:
% ping hostname
If the remote system is accepting ICMP transmissions, the following message is displayed:
hostname is alive
This message indicates that the remote system responded to the ICMP request. However, if the system is down, cannot receive the ICMP packets, or if there is a routing problem between your system and the remote system, you receive the following response from the ping command:
no answer from hostname
Packet loss can cause network connections to seem sluggish because additional time is spent retransmitting dropped data. Use the –s option of the ping command to determine if packets between your system and a remote system are being dropped:
% ping -s hostname
In the following example, the ping -s hostname command continually sends packets to the specified system until you send an interrupt character or a time out occurs:
% ping -s host1.domain8 PING host1.domain8 : 56 data bytes 64 bytes from host1.example.COM (198.51.100.64): icmp_seq=0. time=1.67 ms 64 bytes from host1.example.COM (198.51.100.64): icmp_seq=1. time=1.02 ms 64 bytes from host1.example.COM (198.51.100.64): icmp_seq=2. time=0.986 ms 64 bytes from host1.example.COM (198.51.100.64): icmp_seq=3. time=0.921 ms 64 bytes from host1.example.COM (198.51.100.64): icmp_seq=4. time=1.16 ms 64 bytes from host1.example.COM (198.51.100.64): icmp_seq=5. time=1.00 ms 64 bytes from host1.example.COM (198.51.100.64): icmp_seq=5. time=1.980 ms ^C ----host1.domain8 PING Statistics---- 7 packets transmitted, 7 packets received, 0% packet loss round-trip (ms) min/avg/max/stddev = 0.921/1.11/1.67/0.26
The packet-loss statistic indicates whether the host has any dropped packets. If the ping command indicates that there has been packet loss, check the status of the network by using the ipadm and netstat commands. Refer to Monitoring IP Interfaces and Addresses in Configuring and Managing Network Components in Oracle Solaris 11.3 and Monitoring Network Status With the netstat Command for more details.