icmp – socket(): Operation not permitted

(Last Updated On: October 10, 2020)

Situation

$ ./besttrace -q 1 1.1.1.1
dial ip:icmp 1.1.1.1: socket: operation not permitted

$ /usr/sbin/hping3 -S -p 53 1.1.1.1
[open_sockraw] socket(): Operation not permitted
[main] can't open raw socket

Solutions

net.ipv4.ping_group_range = 0 2147483647
sudo setcap cap_net_raw,cap_net_admin,cap_dac_override+eip /usr/sbin/hping3

※ 단 bin 파일의 소유자는 root 이어야함.