PromptHub
Back to Blog
Developer Tools Network Monitoring

domcyrus/rustnet: Per-Process Network Monitoring with Deep Packet Inspection

B

Bright Coding

Author

10 min read 52 views
domcyrus/rustnet: Per-Process Network Monitoring with Deep Packet Inspection

domcyrus/rustnet: Per-Process Network Monitoring with Deep Packet Inspection

Network visibility remains one of the most persistent gaps in modern systems administration. Standard tools force a binary choice: lightweight connection lists with netstat or ss that lack process context, or powerful packet captures with tcpdump and Wireshark that require root access, X11 forwarding, or post-processing to map packets to applications. Neither cleanly answers the question every developer and operator actually asks: which process on this machine is making this connection, and what is it actually doing?

The tweet framing captures this tension precisely: deep packet inspection without tcpdump or root access sounds like an impossibility until you examine how domcyrus/rustnet rearchitects the problem. With 4,721 GitHub stars, 219 forks, and active development through July 2026, this Rust-based terminal tool offers per-process network monitoring with protocol identification, sandboxed privilege handling, and cross-platform support—no X11 required, no raw root shells for ongoing inspection.

What is domcyrus/rustnet?

domcyrus/rustnet is an open-source terminal UI (TUI) application written in Rust that provides real-time, per-process network connection monitoring with deep packet inspection (DPI) capabilities. Licensed under Apache 2.0 and primarily distributed via GitHub releases, crates.io, and major package managers, it occupies a distinct niche between connection enumerators and full packet analyzers.

The project is built on a foundation of mature systems libraries: ratatui for the terminal interface, libpcap for packet capture, libbpf-rs for eBPF integration on Linux, crossbeam for concurrency, and ring for cryptographic operations. GeoIP lookups use local MaxMind GeoLite2 databases with no external network calls.

What distinguishes domcyrus/rustnet architecturally is its multi-platform process attribution strategy. Rather than forcing a single mechanism across operating systems, it uses eBPF on Linux (kernel 5.13+), PKTAP on macOS, and native APIs on Windows and FreeBSD. This platform-specific optimization matters because process-to-socket mapping is fundamentally OS-dependent—Linux's sock_diag netlink interface, macOS's proc_pidinfo, and Windows' GetExtendedTcpTable each have different capabilities and constraints.

The project explicitly positions itself as complementary to, not replacing, Wireshark and tcpdump. Its annotated PCAPNG export feature (--pcapng-export) embeds process names, PIDs, direction, DPI results, and GeoIP data as per-packet comments—creating Wireshark-ready captures where every packet arrives pre-labeled with its owning process.

Key Features

Per-process attribution is the core differentiator. Every TCP, UDP, and QUIC connection maps to its owning process through OS-native mechanisms. On Linux, eBPF programs attach to tracepoints for minimal-overhead socket tracking; fallback to procfs occurs automatically if eBPF loading fails or capabilities are insufficient. The README notes an important eBPF limitation: kernel comm fields truncate to 16 characters, so multi-threaded applications like Firefox may display thread names ("Socket Thread", "Isolated Web Co") rather than the parent process name.

Deep packet inspection operates without external dissectors. The tool identifies HTTP, HTTPS/TLS with SNI extraction, DNS, SSH, FTP, QUIC, MQTT, BitTorrent, STUN, NTP, mDNS, LLMNR, DHCP, SNMP, SSDP, and NetBIOS directly. This matters for environments where installing full Wireshark dissector sets is impractical or where automated SNI extraction enables quick service identification without certificate inspection.

Security sandboxing is implemented per-platform: Landlock on Linux 5.13+, Seatbelt on macOS, and token privilege drop with job-object child-process blocking on Windows. Privileges drop immediately after libpcap initializes, reducing the attack surface of a tool that necessarily begins with elevated capabilities.

TCP analytics include real-time retransmission detection, out-of-order packet counting, and fast-retransmit identification—both per-connection and aggregate. These metrics typically require tcpdump post-processing or specialized monitoring infrastructure.

Connection lifecycle visualization uses protocol-aware timeouts with white/yellow/red staleness indicators. HTTP connections persist 10 minutes (supporting keep-alive), SSH 30 minutes, QUIC connected state 3 minutes, DNS 30 seconds. Toggle t retains closed connections for forensic analysis.

Kubernetes attribution (optional kubernetes feature) maps connections to pods, namespaces, and containers, available in exports and through pod:, ns:, container: filters. The companion kubectl-rustnet plugin enables ephemeral debug pod deployment.

Use Cases

Incident response on production servers illustrates the tool's SSH-friendly design. When an unexpected network spike occurs, operators can ssh into the target, run sudo rustnet, and immediately see which process owns each active connection—no X11 forwarding, no capture files to transfer, no post-processing correlation. The Activity tab (press 3) ranks processes by egress/ingress with 60-second rolling windows, enabling quick identification of unexpected uploaders even after connections close.

TLS service inventory without certificate access leverages SNI extraction from the DPI engine. Security teams can catalog which internal services communicate with which external endpoints without deploying intercept proxies or managing CA infrastructure. The sni: filter (sni:api) narrows to specific API endpoints.

Cross-platform development environment consistency matters for teams running mixed Linux, macOS, and Windows workstations. A single tool with consistent keyboard shortcuts (/pattern for regex filtering, s/S for sort cycling) reduces context-switching overhead compared to platform-specific alternatives.

Kubernetes network debugging via the optional feature and kubectl plugin enables ephemeral inspection without modifying cluster networking or deploying persistent sidecars. Connection attribution to pod/namespace/container appears in JSON and PCAPNG exports for audit trails.

Forensic capture with process context uses --pcapng-export to generate Wireshark files where every packet comment includes PID, process name, direction, and GeoIP. This eliminates the post-capture correlation step that typically requires ss -tanp snapshots synchronized with tcpdump start times.

Installation & Setup

The project distributes through multiple channels. Reproduce commands exactly as documented:

Homebrew (macOS / Linux):

brew install rustnet

Ubuntu (25.10+):

sudo add-apt-repository ppa:domcyrus/rustnet
sudo apt update && sudo apt install rustnet

Fedora (42+):

sudo dnf copr enable domcyrus/rustnet
sudo dnf install rustnet

openSUSE Tumbleweed:

sudo zypper addrepo https://download.opensuse.org/repositories/home:/domcyrus:/rustnet/openSUSE_Tumbleweed/home:domcyrus:rustnet.repo
sudo zypper refresh
sudo zypper install rustnet

Arch Linux:

sudo pacman -S rustnet

Nix / NixOS:

nix-shell -p rustnet
# Then inside the shell: sudo rustnet

From crates.io:

cargo install rustnet-monitor

Windows (Chocolatey, Administrator PowerShell):

# Requires Npcap (https://npcap.com) installed with "WinPcap API-compatible Mode" enabled
choco install rustnet

FreeBSD: Download from rustnet-bsd releases.

Docker↗ Bright Coding Blog:

docker run --rm --network host --cap-add NET_RAW ghcr.io/domcyrus/rustnet

Privilege setup is required for packet capture. The standard approach:

# Quick start (all platforms)
sudo rustnet

# Linux: Grant capabilities to run without sudo (recommended)
sudo setcap 'cap_net_raw,cap_bpf,cap_perfmon+eip' $(which rustnet)
rustnet

The capability approach is preferred for regular use: cap_net_raw for libpcap, cap_bpf for eBPF program loading, cap_perfmon for extended BPF operations. If the TUI shows eBPF unavailable after capability setup, the README directs to a specific troubleshooting section in INSTALL.md.

Real Code Examples

Basic invocation with interface selection and localhost visibility:

# Monitor specific interface, show localhost connections
rustnet -i eth0 --show-localhost

This targets a single interface rather than the default, and includes loopback traffic often excluded to reduce noise. The --show-localhost flag matters for development environments where services communicate over 127.0.0.1.

Annotated capture export for Wireshark analysis:

rustnet --pcapng-export capture.pcapng

The resulting file contains standard PCAPNG packet data with per-packet comments embedding: process name, PID, traffic direction, identified protocol, SNI when present, and GeoIP country. Opening in Wireshark eliminates the manual correlation between tcpdump output and lsof/ss process listings.

Classic PCAP with JSONL sidecar for offline correlation:

rustnet --pcap-export capture.pcap

This generates capture.pcap plus capture.pcap.jsonl with process metadata. The README references scripts/pcap_enrich.py for post-processing when full PCAPNG embedding is unnecessary.

Disabling eBPF for full process names (higher CPU overhead):

cargo build --release --no-default-features

This build flag produces a procfs-only binary. The tradeoff is explicit: 16-character comm field truncation via eBPF versus complete process paths via /proc parsing with increased CPU usage.

Kubernetes-enabled build and execution:

# Official Docker image includes kubernetes feature
# Or build with: cargo build --release --features kubernetes

# In cluster, via kubectl plugin:
kubectl rustnet

The plugin runs rustnet as an ephemeral debug pod with appropriate service account permissions for pod metadata access.

Advanced Usage & Best Practices

Filter composition follows Vim/fzf conventions. Combine multiple constraints without explicit AND operators: dport:443 sni:github.com narrows to HTTPS connections to GitHub. Regex via /(?i)pattern enables case-insensitive matching. For security workflows, state:syn_recv identifies half-open connections potentially indicating SYN flood conditions.

Performance optimization involves understanding the eBPF fallback behavior. If process names appear truncated ("ThreadPoolForeg" for Chrome), this confirms eBPF is active. For accurate process identification during incident response, consider the procfs build despite overhead, or cross-reference PIDs with ps.

Capture strategy should match analytical needs. Live TUI inspection suits real-time troubleshooting; --pcapng-export preserves process context for later Wireshark analysis; --pcap-export with JSONL sidecar enables programmatic post-processing. The README notes these are "best-effort" packet comments—packet loss during high-throughput periods may occur.

Sandbox verification: On Linux 5.13+, Landlock restrictions apply after libpcap initialization. The SECURITY.md document details these restrictions; operators in regulated environments should review before deployment.

Comparison with Alternatives

Tool Process Attribution Deep Packet Inspection SSH-Friendly Sandbox Cross-Platform
domcyrus/rustnet Native (eBPF/PKTAP/API) Built-in (15+ protocols) TUI native Landlock/Seatbelt/Token drop Linux/macOS/Windows/FreeBSD
Wireshark/tshark None (packet-only) Extensive (dissector ecosystem) No X11 None Most platforms
tcpdump None Limited (BPF filter syntax) CLI None Most platforms
bandwhich Native None (connection only) TUI native None Linux/macOS
sniffnet Limited Basic protocol detection TUI native None Most platforms

Wireshark and tcpdump remain superior for full protocol analysis and custom dissectors. bandwhich (4,800+ stars) offers similar TUI process attribution but lacks DPI, PCAP export, and sandboxing. sniffnet provides protocol detection without per-process granularity. domcyrus/rustnet's distinctive position is the intersection: process attribution plus protocol identification plus exportable captures plus sandboxed execution.

FAQ

Does domcyrus/rustnet require root? Initial packet capture requires elevated privileges, but Linux capabilities (cap_net_raw,cap_bpf,cap_perfmon) enable non-root execution. Sandboxing drops privileges immediately after libpcap initializes.

Why do some process names appear truncated? Linux eBPF uses the kernel comm field limited to 16 characters. Multi-threaded applications show thread names. Build with --no-default-features for full procfs names.

Can I run this in a Kubernetes cluster? Yes, via the optional kubernetes feature (enabled in official Docker image) and the kubectl-rustnet plugin for ephemeral debug pods.

What protocols does DPI identify? HTTP, HTTPS/TLS with SNI, DNS, SSH, FTP, QUIC, MQTT, BitTorrent, STUN, NTP, mDNS, LLMNR, DHCP, SNMP, SSDP, and NetBIOS.

Is the GeoIP lookup making external calls? No. Country lookups use local MaxMind GeoLite2 databases.

What's the license? Apache License 2.0.

How current is development? Last commit July 16, 2026; 4,721 stars; 219 forks; active CI via GitHub Actions.

Conclusion

domcyrus/rustnet addresses a genuinely underserved gap: the need to understand which process is doing what on the network without the operational overhead of full packet capture infrastructure or the limitations of connection-only tools. Its technical credibility rests on specific architectural choices—multi-platform native APIs, optional eBPF with documented limitations, per-platform sandboxing, and complementary Wireshark integration rather than replacement.

The tool suits systems administrators, security engineers, and developers who need quick, SSH-deployable network visibility with enough protocol intelligence to act. It does not replace Wireshark for deep protocol analysis, nor does it replace dedicated monitoring infrastructure for historical trending. It excels at the specific moment of needing to answer: what's this machine doing right now, and who owns that connection?

For installation options, architecture details, and contribution guidelines, visit the project repository at https://github.com/domcyrus/rustnet.

Comments (0)

Comments are moderated before appearing.

No comments yet. Be the first to share your thoughts!

Recommended Prompts

View All
All tools