Yes, that is correct. The ping utility uses ICMP echo request/ICMP echo reply while, by default, Net::Ping tries to establish a TCP session with the echo port of the target host.
Try making this change to your program:
$p = Net::Ping->new('icmp');
w01b0rji.cube.fred.ch `ping` OK : w01b0rji.cube.fred.ch is alive
w01b0rji.cube.fred.ch $p->ping NOK
svmoloch.flur.fred.ch `ping` OK : svmoloch.flur.fred.ch is alive
svmoloch.flur.fred.ch $p->ping NOK
22.214.171.124 `ping` OK : 126.96.36.199 is alive
188.8.131.52 $p->ping NOK
Just to clarify, what you are seeing here is most likely the result of the specified hosts allowing ICMP echo requests, but not having a service listening to the echo port.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||