#1128644 iputils-ping: ping fails in network namespace due to missing cap_net_raw+p

Package:
iputils-ping
Source:
iputils-ping
Description:
Tools to test the reachability of network hosts
Submitter:
James Tocknell
Date:
2026-02-24 14:49:02 UTC
Severity:
normal
Tags:
#1128644#5
Date:
2026-02-22 07:43:44 UTC
From:
To:
Dear Maintainer,

Due to the removal of cap_net_raw+p from ping, ping no longer works in network
namespaces (such as those created by ip netns). The presence or absence of
linux-sysctl-defaults does not change this. Can the removal of the capability be
reverted, a debconf setting be created to add the capability (it seems that
iproute2 does this for ip vrf) or a separate package with the capability added
be uploaded?

Regards
James

#1128644#10
Date:
2026-02-23 15:21:27 UTC
From:
To:
Control: tags -1 + moreinfo

ping is fully functional in non-default network namespaces without
cap_net_raw+p and is used in such a configuration every day.

You'll need to provide more information about exactly how you're
configuring your namespaces and invoking ping, as well as exactly what
the failure is, so we can understand better what's actually going wrong.

noah

#1128644#17
Date:
2026-02-24 11:49:04 UTC
From:
To:
Hi Noah

A script which shows the issue is (run as a non-root user):

$ sudo ip netns add temp &&
    sudo ip -netns temp link set lo up &&
    sudo ip netns exec temp su $USER -c "ping 127.0.0.1"
[sudo] password for <user>:
ping: socktype: SOCK_RAW
ping: socket: Operation not permitted
ping: => missing cap_net_raw+p capability or setuid?

You can call sysctl with a modified net.ipv4.ping_group_range range
within the namespace, but that requires that it occurs in every new
namespace, whereas the capability addition can be done once.

The example of how iproute2 handles optionally adding capabilities is at
https://salsa.debian.org/kernel-team/iproute2/-/blob/debian/sid/debian/iproute2.postinst,
I can port this over for ping and make a merge request on salsa if
that would help?

Regards
James

#1128644#22
Date:
2026-02-24 14:46:28 UTC
From:
To:
Correct.

No, we removed that code deliberately some time ago, and will not be
installing ping with additional capabilities in the future.

https://salsa.debian.org/debian/iputils/-/commit/b86c32f4c502b95bab6e37b5947a28a25fcbb6a1#ea5e2ec0d0cf357b4a00c4bc209030230895b2bd

noah