How to Send Ping Requests Without Root Privileges Using UDP Sockets in Rust
By
bouk
Crusty in the right places. Worth the chew.
Summary
The article explains how to send ping requests without root privileges by using a UDP socket with ICMP protocol instead of creating a raw socket. The author notes that while standard ICMP sockets require root access, the ping command-line tool works without it, and reveals the technique of using UDP sockets with protocol flags. Due to a lack of simple examples online and poor performance from LLMs on this topic, the author created and shared a Rust implementation on GitHub.
Key quotes
· 4 pulledSending a ping by creating an ICMP socket normally requires root: you can't create a raw socket to send ICMP packets without it.
The ping command line tool works without root however, how is that possible? It turns out you can create a UDP socket with a protocol flag, which allows you to send the ping rootless.
I couldn't find any simple examples of this online and LLMs are surprisingly bad at this (probably because of the lack of examples).
Therefore I posted an example on GitHub in Rust.
You might also wanna read
BGP Lab Project Expanded to Include Full IPv6 Feed
The author extends their BGP lab project to support full IPv6 feeds, following requests from readers who previously received IPv4 BGP feeds.
Whosthere: A Go-based LAN discovery tool with interactive TUI for unprivileged network scanning
Whosthere is a Go-based Local Area Network (LAN) discovery tool with an interactive Terminal User Interface (TUI). It performs unprivileged,
Investigating Intermittent ECONNRESET Errors in Local TCP Connections (Part 1)
A technical blog post investigating mysterious ECONNRESET errors occurring between two services communicating over TCP on the same machine.
IPv8: An Alternative IPv4 Successor with Backward Compatibility and Integrated Network Management
This article introduces IPv8, an alternative successor to IPv4 that differs from IPv6 by focusing on integrated network management and singl
How to get a free *.city.state.us locality domain in the US
This article explains how US residents can obtain a free locality domain name (e.g., somename.city.state.us) for their town. It covers the h
Cloudflare fixes CUBIC congestion control bug in QUIC implementation that permanently pinned performance at minimum
Cloudflare engineers discovered and fixed a bug in the CUBIC congestion control algorithm (RFC 9438) used in their QUIC implementation (quic
