PingX is a simple and practical network diagnostic tool designed to replace system ping and ping6 commands. It supports ICMP Ping, TCP Ping (via SYN handshake), and HTTP Ping (via HEAD requests), allowing for comprehensive connectivity testing across IPv4 and IPv6.
- Multi-Protocol: ICMP, TCP, and HTTP probing.
- Dual Stack: Full support for IPv4, IPv6, and domain resolution.
- Concurrency: Probe multiple targets simultaneously.
cargo install pingxOn Linux systems, ICMP ping requires special permissions. After installation, run:
sudo setcap cap_net_raw+ep $(which pingx)Note: The permissions will be lost if you reinstall or recompile pingx. You'll need to run the command again.
# IPv4
pingx 1.1.1.1
# IPv6
pingx 2400:3200::1
# Domain (IPv6 preferred)
pingx example.comPingX automatically selects the protocol based on the target format:
- Starts with
http://orhttps://: Uses HTTP protocol. - Format
<host>:<port>: Uses TCP protocol. - Others: Defaults to ICMP protocol.
# Auto-detected as HTTP
pingx https://www.google.com
# Auto-detected as TCP (port 80)
pingx 1.1.1.1:80Use flags to force specific protocols (target must match required format):
-4: Force IPv4 ICMP.-6: Force IPv6 ICMP.-t/--tcp: Force TCP protocol (Target must include port, e.g.,ip:port).-H/--http: Force HTTP protocol.
# Force IPv4
pingx -4 example.com
# Force TCP
pingx -t example.com:443Supports probing multiple targets simultaneously. In multi-target mode, quiet mode (-q) is automatically enabled, showing only statistics at the end.
pingx 1.1.1.1 www.github.com-c <COUNT>: Stop after sending count packets.-i <INTERVAL>: Wait interval seconds between sending each packet (default 1.0s).-w <DEADLINE>: Stop running after deadline seconds.-W <TIMEOUT>: Time to wait for a response, in seconds (default 1.0s).-s <SIZE>: Size of ICMP payload in bytes (default 56).-q: Quiet output. Only displays summary statistics.
PingX 是一款简单实用的网络诊断工具,旨在替代系统的 ping 和 ping6 命令。它不仅支持标准的 ICMP Ping,还支持 TCP Ping(发送 SYN 握手报文)和 HTTP Ping(发送 HEAD 请求),可对 IPv4 和 IPv6 目标进行全面的连通性测试。
- 多协议支持: 支持 ICMP、TCP 和 HTTP 协议探测。
- 双栈支持: 完美支持 IPv4、IPv6 地址及域名解析。
- 并发探测: 支持同时对多个目标发起探测。
cargo install pingx在 Linux 系统上,ICMP ping 需要特殊权限。安装完成后,请运行:
sudo setcap cap_net_raw+ep $(which pingx)注意:如果重新安装或重新编译 pingx,权限将会丢失,需要重新运行上述命令。
# IPv4
pingx 1.1.1.1
# IPv6
pingx 2400:3200::1
# 域名 (优先使用 IPv6)
pingx example.comPingX 会根据目标格式自动选择协议:
http://或https://开头:使用 HTTP 协议。<host>:<port>格式:使用 TCP 协议。- 其他:默认为 ICMP 协议。
# 自动识别为 HTTP
pingx https://www.google.com
# 自动识别为 TCP (端口 80)
pingx 1.1.1.1:80使用参数强制指定协议(此时参数必须符合特定格式):
-4: 强制使用 ICMP 协议检测 IPv4 目标。-6: 强制使用 ICMP 协议检测 IPv6 目标。-t/--tcp: 强制使用 TCP 协议 (目标必须包含端口,如ip:port)。-H/--http: 强制使用 HTTP 协议。
# 检测 IPv4
pingx -4 example.com
# 强制使用 TCP 协议
pingx -t example.com:443pingx 可以并发对多个目标以不同协议进行检测。多目标模式下会自动开启安静模式 (-q),仅在结束时输出统计信息。
pingx 1.1.1.1 www.github.com-c <COUNT>: 发送数据包的数量。-i <INTERVAL>: 发包间隔(秒),默认 1.0 秒。-w <DEADLINE>: 持续运行的时间限制(秒)。-W <TIMEOUT>: 等待响应的超时时间(秒),默认 1.0 秒。-s <SIZE>: ICMP 数据包大小(默认 56 字节)。-q: 安静模式,不显示逐个包的详细信息,仅显示统计结果。