Ping: sendmsg: operation not permitted error after installing iptables on Arch GNU/Linux

Solution 1:

The error message:

Ping: sendmsg: operation not permitted

means that your server is not allowed to send ICMP packets. You need to allow your server to send traffic via one or more of the configured interfaces. You can do this by:

  1. Set OUTPUT chain policy to ACCEPT to allow all outgoing traffic from your box:

    sudo iptables -P OUTPUT ACCEPT
    
  2. Set OUTPUT chain policy to DROP and then allow selectively the type of traffic you need.

This applies to all chains not only the OUTPUT chain. INPUT chain controls the traffic received by your box. FORWARD chain deals with traffic forwarded through the box.

Solution 2:

To me, on Debian 9, it helped just to reinstall ping:

apt-get install --reinstall iputils-ping