Hello! Tell me how to allow ping via ICMP in Ubuntu? Through TCP everything pings normally, and through ICMP it says that there are no privileges

code example:

$pong = net::ping->new("icmp"); (defined $pong) or die "Couldn't create Net::Ping object: $!\n": if ($pong->ping("kingkong.com")) { print "The giant ape lives!\n"; } else { print "All hail mighty Camera, friend of children!\n"; } 
  • What is the version of ubuntu? - atom-22
  • ping is essentially a utility for exchanging ICMP messages with the specified remote server. That is, executing the command "ping 8.8.8.8" you send to the server "8.8.8.8" ICMP Echo and (not) receive ICMP Reply. Most likely, you played ping-pong with ICMP requests without knowing it. If not, please give the command being executed. - uzumaxy
  • Here is an example $ pong = net :: ping-> new ("icmp"); (defined $ pong) or die "Couldn't create Net :: Ping object: $! \ n": if ($ pong-> ping ("kingkong.com")) {print "The giant ape lives! \ n" ; } else {print "All hail mighty Camera, friend of children! \ n"; } - Olga12
  • @ Olga12, see avp @ avp-xub11: /etc/rsyslog.d$ ll / bin / ping -rwsr-xr-x 1 root 34740 Nov 8 2011 / bin / ping * avp @ avp-xub11: / etc / rsyslog .d $ file / bin / ping See the s bit in the rights and owner root? ICMP is implemented through the RAW socket; by default, this requires root privileges. Try running your script from under sudo, I think it will. - avp

1 answer 1

response from comment:

ICMP is implemented through the RAW socket; by default, this requires root privileges. Try running your script from under sudo, I think it will.