一般测试网络连通性和延迟最常使用Ping命令,但是如果对方禁止了ICMP包将无法ping通,telnet命令虽然可以测试端口连通性,但却无法检测延迟,PaPing 不仅可以测试连通性还可以检测网络延迟情况。

下载PaPing

wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/paping/paping_1.5.5_x86-64_linux.tar.gz
tar zxvf paping_1.5.5_x86-64_linux.tar.gz

使用方法

  • -p : --port N 指定被测试服务的 TCP 端口(必须);
  • --nocolor : 屏蔽彩色输出;
  • -t : --timeout 指定超时时长,单位为毫秒,默认值为 1000;
  • -c : --count N 指定测试次数。

比如我要测试www.moderatecontent.com 443端口延迟情况,输入命令:

[root@ultravps ~]# ./paping -p 443 -c 4 www.moderatecontent.com
paping v1.5.5 - Copyright (c) 2011 Mike Lovell

Connecting to www.moderatecontent.com on TCP 443:

Connected to 66.96.149.31: time=73.29ms protocol=TCP port=443
Connected to 66.96.149.31: time=73.36ms protocol=TCP port=443
Connected to 66.96.149.31: time=73.57ms protocol=TCP port=443
Connected to 66.96.149.31: time=73.32ms protocol=TCP port=443

Connection statistics:
    Attempted = 4, Connected = 4, Failed = 0 (0.00%)
Approximate connection times:
    Minimum = 73.29ms, Maximum = 73.57ms, Average = 73.38ms

此文部分内容参考了:使用 PsPing & PaPing 进行 TCP 端口连通性测试