| Lesson 2 | The ping command |
| Objective | Use the ping command to check network status. |
ping. The ping command uses the Internet Control Message Protocol (ICMP)[1]. This protocol, which operates at the network layer of the TCP/IP[2] protocol stack, is used to pass error information among machines on the Internet.ping generates a series of ICMP echo-request packets directed at a particular machine. Upon receipt of such a packet, the target machine is required to generate an ICMP echo-reply packet directed at the sender. If these packets can be successfully exchanged, a network connection between the two machines exists.
ping can be used to test network connectivity.
ping when your network is broken. In particular, name service may not be available. In this case, you should use IP addresses instead of host names, and you should use the appropriate option to ping (usually -n) to tell the ping not to try to look up host names, but rather to report only numbers.
ping command.
| Option | Purpose |
-n | Do not try to look up IP names; just use numbers. Use this option if name service is broken. |
-c count | Stop after sending count packets. |
-i interval | Wait interval seconds between packets. |
-r | Ignore the routing table; assume the host is on the local network. Useful if default route is messed up, or with other routing problems. |
-s size | Send a packet of given size (default is 64 bytes total). |
ping is set up a little differently. The Solaris equivalent of Linux ping is
ping -s hostname, which enables you to receive a report on each packet sent to the specified machine. (If you do not include the
-s option with Solaris ping, the report you receive will simply state whether the machine you ping is alive or not.)
Other useful Solaris ping options include:
| Option | Purpose |
-n | Do not try to look up IP names; just use numbers. Use this option if name service is broken. |
-r | Ignore the routing table; assume the host is on the local network. Useful if default route is messed up, or with other routing problems. |
-s size | Send a packet of given size. |
-c number | Send specified number of packets. |