-
Step 1: adapt your code
To use icmplib without root privileges, you must set the
privileged
parameter toFalse
on theping
andmultiping
functions, as well as their asynchronous variants and the low level classes.By disabling this parameter, icmplib let the kernel handle some parts of the ICMP headers.
The
traceroute
function does not have this parameter. It should always be run as root to receive ICMP Time Exceeded messages from gateways. -
Step 2: allow this feature on your operating system
On some Linux systems, you must allow this feature:
$ echo 'net.ipv4.ping_group_range = 0 2147483647' | sudo tee -a /etc/sysctl.conf $ sudo sysctl -p
You can check the current value with the following command:
$ sysctl net.ipv4.ping_group_range net.ipv4.ping_group_range = 0 2147483647
Since Ubuntu 20.04 LTS, this manipulation is no longer necessary.