The ‘ping’ command on Solaris can send you off in wrong direction of troubleshooting if you do not use it carefully. Consider the following basic command
# ping sunsolve.sun.com
sunsolve.sun.com is alive
#
However, if you are also interested in round trip times and control the number of packets sent, then you could do the following
# ping -s sunsolve.sun.com
PING sunsolve.sun.com: 56 data bytes
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=0. time=49. ms
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=1. time=49. ms
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=2. time=49. ms
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=3. time=50. ms
^C
—-sunsolve.sun.com PING Statistics—-
4 packets transmitted, 4 packets received, 0% packet loss
round-trip (ms) min/avg/max = 49/49/50
#
Note that you have to issue a Ctrl-C to break the test. Not very helpful when I am trying to script it for a cronjob. Instead, you can specify the number of times to send the ICMP packets for the test BUT ONLY if you specify the size of the data. Almost all other ‘ping’ implementations offer either a -i or -c option to specify just the count. The default data-size is 56 bytes and that should suffice.
# ping -s sunsolve.sun.com 56 5
PING sunsolve.sun.com: 56 data bytes
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=0. time=49. ms
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=1. time=49. ms
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=2. time=49. ms
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=3. time=49. ms
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=4. time=49. ms—-sunsolve.sun.com PING Statistics—-
5 packets transmitted, 5 packets received, 0% packet loss
round-trip (ms) min/avg/max = 49/49/49
#
Yet another caveat with the Solaris ping is that it will try to do a name lookup for its output.
# ping -s 192.18.108.40 56 3
PING 192.18.108.40: 56 data bytes
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=0. time=50. ms
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=1. time=50. ms
64 bytes from sunsolve.Sun.COM (192.18.108.40): icmp_seq=2. time=49. ms—-192.18.108.40 PING Statistics—-
3 packets transmitted, 3 packets received, 0% packet loss
round-trip (ms) min/avg/max = 49/49/50
Notice how it did a name lookup and inserted sunsolve.sun.com even though I specified an IP address? This could potentially misdirect your troubleshooting if the object of your tests is a DNS server or a issue. Instead, we can pass a “-n” option to prevent the name lookups.
# ping -ns 192.18.108.40 56 3
PING 192.18.108.40 (192.18.108.40): 56 data bytes
64 bytes from 192.18.108.40: icmp_seq=0. time=49. ms
64 bytes from 192.18.108.40: icmp_seq=1. time=49. ms
64 bytes from 192.18.108.40: icmp_seq=2. time=49. ms—-192.18.108.40 PING Statistics—-
3 packets transmitted, 3 packets received, 0% packet loss
round-trip (ms) min/avg/max = 49/49/49
My take: its a bit annoying that I have to pass 2 args more than I have to when I did not ask for it.

Recent Comments