netutils — Network Diagnostic Toolkit
English | 中文
A cross-platform command-line network diagnostic tool written in Rust. Covers network interfaces, routing, egress detection, proxy detection, Ping, DNS, DNS cache, DNS query path, route decision analysis, TLS handshake and certificate diagnostics, HTTP request testing, HTTP request path analysis, Traceroute, port scanning, connectivity testing, connection listing, one-click diagnostics, full-link diagnostics, and plugin-based SSE/WebSocket/MCP diagnostics.
Features
| Command |
Description |
Example |
(none) |
Show all network info |
netutils |
iface |
Network interface list |
netutils iface |
egress |
Traffic egress + routing logic |
netutils egress |
route |
Routing table |
netutils route |
route-get |
Show the actual route selected for a target and whether it uses TUN/VPN |
netutils route-get google.com |
proxy |
Proxy settings |
netutils proxy |
ping |
Ping host (ICMP/TCP) |
netutils ping google.com --count 4 |
dns |
DNS query (UDP/53, DoH, or DoT) |
netutils dns example.com --type mx |
dns-cache |
Inspect or flush system DNS cache |
netutils dns-cache google.com |
dns-path |
Show DNS servers and the local route to each DNS server |
netutils dns-path google.com |
dns-compare |
Compare default resolution with direct queries to specific DNS servers |
netutils dns-compare google.com --server 8.8.8.8 |
dns-leak |
Detect DNS leaks (whether DNS queries bypass VPN/TUN/proxy) |
netutils dns-leak |
proxy-test |
Check proxy reachability, DNS behavior, and request stability |
netutils proxy-test google.com --proxy socks5h://127.0.0.1:7890 --count 20 |
tls |
TLS handshake and certificate diagnostics |
netutils tls google.com --sni google.com |
trace |
Traceroute |
netutils trace google.com |
mtu |
Path MTU discovery and PMTUD blackhole detection |
netutils mtu google.com |
scan |
Port scan |
netutils scan 192.168.1.1 80,443 |
check |
Connectivity test |
netutils check https://example.com |
http |
Send one HTTP request and show the response result |
netutils http https://example.com --show-headers |
sse |
Plugin command: test a Server-Sent Events stream |
netutils install sse && netutils sse https://example.com/events |
ws |
Plugin command: test WebSocket handshake and messages |
netutils install ws && netutils ws wss://echo.websocket.events --message ping |
mcp |
Plugin command: test MCP Streamable HTTP initialization and tools list |
netutils install mcp && netutils mcp https://example.com/mcp |
subdomain |
Plugin command: passively discover subdomains from public sources |
netutils install subdomain && netutils subdomain example.com |
socks-probe |
Plugin command: SOCKS5 protocol-level probe (method negotiation, RFC 1929 auth, optional CONNECT) |
netutils install socks-probe && netutils socks-probe 127.0.0.1:1080 |
chrome-proxy |
Plugin command: launch Chrome through a local chained proxy bridge |
netutils install chrome-proxy && netutils chrome-proxy https://www.google.com/generate_204 --proxy socks5://127.0.0.1:7890 |
connections |
Network connections (TCP/UDP) |
netutils connections --state LISTEN |
process |
Find local TCP/UDP processes by port |
netutils process --port 8080 |
diag |
One-click diagnostics |
netutils diag |
diagnose |
Full-link diagnostics (DNS→Ping→TCP→HTTPS→Trace) |
netutils diagnose example.com |
path |
HTTP request path analysis (DNS→proxy/egress→Trace→TCP/TLS/HTTP) |
netutils path https://myip.ipipv.com |
completions |
Generate a shell completion script |
netutils completions bash > netutils.bash |
man |
Generate a roff man page on stdout |
netutils man > netutils.1 |
Find Processes by Port
Query local TCP and UDP endpoints by their local port. The lookup does not match a remote peer port:
netutils process --port 8080
netutils --json process --port 8080
netutils process kill 1234
netutils --json process kill 1234 --yes
The result groups endpoints by PID and reports partial or unavailable process information separately from a port with no matching endpoint. process kill targets one PID and asks for confirmation in an interactive terminal. JSON and non-interactive use require --yes; without it the command returns immediately without terminating the process.
Installation
# Install from crates.io (recommended)
cargo install netutils-cli
# Use directly after install
netutils --help
Prebuilt Bundles
Each v* tag publishes an archive per platform on the GitHub Releases page containing the core binary and every plugin, so no cargo install is needed:
netutils-v<version>-x86_64-unknown-linux-gnu.tar.gz
netutils-v<version>-aarch64-apple-darwin.tar.gz
netutils-v<version>-x86_64-pc-windows-msvc.zip
Every archive ships with a .sha256 file; verify it before use.
Layout inside the archive:
netutils-v<version>-<target>/
netutils[.exe]
plugins/
chrome-proxy/bin/netutils-chrome-proxy[.exe]
mcp/bin/netutils-mcp[.exe]
socks-probe/bin/netutils-socks-probe[.exe]
sse/bin/netutils-sse[.exe]
subdomain/bin/netutils-subdomain[.exe]
ws/bin/netutils-ws[.exe]
ws/bin/netutils-websocket[.exe]
Plugins run as separate child processes, so they only need to be discoverable. Point NETUTILS_PLUGIN_DIR at the bundled plugins/ directory and every plugin subcommand works without installing anything:
# Linux / macOS
tar xzf netutils-v0.6.0-x86_64-unknown-linux-gnu.tar.gz
cd netutils-v0.6.0-x86_64-unknown-linux-gnu
export NETUTILS_PLUGIN_DIR="$PWD/plugins"
./netutils socks-probe 127.0.0.1:1080
# Windows
Expand-Archive netutils-v0.6.0-x86_64-pc-windows-msvc.zip -DestinationPath .
cd netutils-v0.6.0-x86_64-pc-windows-msvc
$env:NETUTILS_PLUGIN_DIR = "$PWD\plugins"
.\netutils.exe socks-probe 127.0.0.1:1080
Without NETUTILS_PLUGIN_DIR, the plugin directory defaults to %USERPROFILE%\.netutils\plugins ($HOME/.netutils/plugins on Unix), which is where netutils install puts things. Bundled plugins carry no plugin-lock.json, so netutils plugin list reports their integrity as unrecorded — expected, since the archive checksum takes that role here.
Quick Start
# Build from source
git clone https://github.com/dreamsxin/netutils-cli.git
cd netutils-cli
cargo build --release
# Run
./target/release/netutils
# Help
./target/release/netutils --help
# Put a hard limit on the whole command (exit code 124 on timeout)
./target/release/netutils --total-timeout 30 diagnose example.com
Default hostname resolution uses the operating-system resolver, including local hosts, VPN/split-DNS, and system cache behavior. Public resolvers are contacted only when explicitly selected with options such as --server.
One-Click Diagnostics
$ netutils diag
🔍 Network Diagnostics 2026-06-25 14:30:00
✅ [Egress] Network connected (egress: Ethernet 192.168.50.4)
✅ [Domestic DNS] DNS OK (baidu.com → 111.63.65.247, 45ms)
✅ [Global DNS] DNS OK (google.com → 142.250.69.174, 180ms)
✅ [Gateway] Gateway reachable (192.168.50.1, 0.5ms)
⚠️ [Proxy] System proxy enabled (127.0.0.1:7897)
✅ [Domestic HTTP] HTTPS OK (baidu.com → 200, 54ms) [via proxy]
✅ [Global HTTP] HTTPS OK (google.com → 200, 1096ms) [via proxy]
❌ [IPv6] IPv6 unavailable
Time: 8.2s
Full-Link Diagnostics
Automatically runs a complete link check (DNS → Ping → TCP → HTTPS → Traceroute) on a target host and pinpoints the failure:
$ netutils diagnose google.com
🔍 Link Diagnostics: google.com
✅ [① DNS Resolution]
System DNS: google.com → 142.251.188.138 (199ms)
❌ [② Ping Probe]
173.194.43.139 unreachable (100% loss)
❌ [③ TCP Port 443]
Connection failed: timeout (3s)
✅ [④ HTTPS Request]
https://google.com → 200 (807ms) [via proxy]
⚠️ [⑤ Traceroute (max 10 hops)]
Not reached (10 hops)
📍 Conclusion: Host unreachable
Chain: ✅ DNS → ❌ Ping → ❌ TCP → ✅ HTTPS
Time: 20.2s
Auto-conclusion: DNS fail → "DNS resolution failed" / Ping fail → "Host unreachable" / TCP fail → "TCP port unreachable" / HTTPS fail → "HTTPS failed" / All OK → "Link healthy"
Route And DNS Troubleshooting
When you need to answer "why does this request leave through that interface?", use route-get to inspect the kernel route decision for the resolved target IP:
# Show resolution results, selected interface/gateway, interface type, and TUN detection
netutils route-get google.com
# Only show route selection, skip quick trace
netutils route-get google.com --no-trace
When you need to answer "why does DNS resolve like this?", use dns-compare to compare the default system resolution path with direct queries to chosen DNS servers:
# Compare against a specific DNS server
netutils dns-compare google.com --server 8.8.8.8
# Without --server, use the DNS servers configured on the system
netutils dns-compare google.com
When you suspect stale DNS cache after switching proxy or TUN mode:
# Check whether the target exists in system DNS cache and whether it differs from current resolution
netutils dns-cache google.com
# Flush system DNS cache, then inspect again
netutils dns-cache google.com --flush
When you need to see which DNS servers the system will query and which local gateway/interface is used to reach them:
netutils dns-path google.com
netutils dns-path google.com --server 8.8.8.8
When you need to check whether DNS resolution escapes a VPN, TUN interface, or proxy path:
# Use the current system network and system proxy settings
netutils dns-leak
# Observe resolver behavior through an explicit remote-DNS proxy
netutils dns-leak --proxy socks5h://127.0.0.1:1080
# Run five samples per DNS probe provider (default: 3, range: 1-10)
netutils dns-leak --proxy socks5h://127.0.0.1:1080 --count 5
# Perform only local DNS server and route analysis
netutils dns-leak --no-external
# Also measure where an application using encrypted DNS would egress
netutils dns-leak --doh cloudflare
netutils dns-leak --doh cloudflare --dot quad9
--doh and --dot add an Encrypted DNS section. It resolves whoami.akamai.net over the chosen transport — that domain's A record returns the IP of the resolver that performed the lookup — and compares it with the resolver observed on the system path. differs_from_system answers the question the rest of the command cannot: if a browser or application uses encrypted DNS, does its resolution leave from somewhere else? Partial overlap counts as "not different", and missing data on either side reports null rather than guessing.
This section deliberately does not affect risk_level. The risk rating covers the system resolver path only; encrypted DNS is a separate path, and folding it into the same verdict would make the conclusion ambiguous. DoT reports proxy_mode as direct-not-proxyable instead of pretending a proxy was applied.
dns-leak runs two resolver probes concurrently. Surfshark queries random *.ipv4.surfsharkdns.com hostnames and reports resolver IP, ISP, country, city, and its provider-defined Leak flag. The ip-api-edns probe starts at https://edns.ip-api.com/json, follows the service-generated random-host redirect, and reports resolver IP, country, and organization. --count 1..10 controls the number of samples run by each provider, so the default value of 3 produces three Surfshark samples and three ip-api-edns samples. The command also queries the whoami.akamai.net A record as a secondary resolver observation and uses Cloudflare trace only for the HTTP egress IP. Resolver IPs and HTTP egress IPs are reported separately; they are not expected to be identical. Explicit and system proxies are honored for the HTTP probes, so HTTP and socks5h proxies can reveal proxy-side DNS behavior. Use --no-proxy to force direct requests.
For HTTP and socks5h remote-DNS proxies, resolver observations from Surfshark and ip-api-edns are evaluated together. Multiple resolver IPs are considered a normal resolver pool when all samples are successful and their countries agree; differing known Surfshark cities within the same country are also treated as a leak signal. Resolver IPs spanning different countries or known cities are classified as a DNS leak. Missing country data or a partial sample failure produces an inconclusive low result. Surfshark's Leak field remains visible but does not by itself override the geographic consistency result for a remote-DNS proxy.
Local DNS server lists can include inactive adapters, split-DNS entries, scoped resolvers, and loopback stubs. A different local interface is therefore treated as supporting evidence rather than proof by itself. Browser DoH/DoT and application-specific resolvers may still use a different path.
DNS Over HTTPS
dns --doh