All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

How to Send Ping Requests Without Root Privileges Using UDP Sockets in Rust

By

bouk

6mo ago· 2 min readen

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 pulled
Sending 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.
Snippet from the RSS feed
Sending 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 p

You might also wanna read