毫秒和秒的换算工具_学习使用PSTools工具中的psping

初识PsTools

在工作中我们都会想探测某个IP是否能通,基本上都使用过ping命令,但是某些服务器禁用了ping,而且有些时候也想探测某个IP的某个端口是否能通。之前的我一般都是用“telnet ip port”,但是我发现一个不好的体验就是没啥明显的结果,不通的时候会超时要等一下下,通的时候也没啥友好的提示。所以就搜到了【PStools下载:https://docs.microsoft.com/zh-cn/sysinternals/downloads/pstools】,里面的“psping”命令就很适合我这个要求。

PsTools是一款非常好用的远程管理工具应用软件,PsTools软件为用户提供了非常强大的功能,支持远程打开文件、终止进程、关闭重启计算机等。非常的实用。

其中包含的工具简介如下:

1c9d23444d017ff10dc8c743c60475ec.png

psping

下面是“psing -?”查看的帮助信息

PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utilityCopyright (C) 2012-2016 Mark RussinovichSysinternals - www.sysinternals.comPsPing implements Ping functionality, TCP ping, UDP/TCP latency, and UDP / TCPbandwidth measurement.Help usage: psping -? [i|t|l|b]   -? i   Usage for ICMP ping.   -? t   Usage for TCP ping.   -? l   Usage for latency test.   -? b   Usage for bandwidth test.  -nobanner   Do not display the startup banner and copyright message.

使用ICMP ping

执行“psping -? i”

PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utilityCopyright (C) 2012-2016 Mark RussinovichSysinternals - www.sysinternals.comICMP ping usage: psping [-t|-n count[s]] [-i interval] [-w count] [-q] [-h [buckets|val1,val2,...]] [-l requestsize[k]] [-6|-4] destination  -t    Ping until stopped with Ctrl+C and type Ctrl+Break        for statistics.  -n    Number of pings or append 's' to specify seconds e.g. '10s'.  -i    Interval in seconds. Specify 0 for fast ping.  -w    Warmup with the specified number of iterations (default is 1).  -q    Don't output during pings.  -h    Print histogram (default bucket count is 20).        If you specify a single argument, it's interpreted as a bucket        count and the histogram will contain that number of        buckets covering the entire time range of values.        Specify a comma-separated list of times to create a custom        histogram (e.g. "0.01,0.05,1,5,10").  -l    Request size. Append 'k' for kilobytes.  -4    Force using IPv4.  -6    Force using IPv6.For high-speed ping tests use -q and -i 0.

执行psping -4 -n 10 -w 2 -h 10 www.baidu.com

  • -4 代表强制使用IPv4联机
  • -n 代表正式ping包的个数,或者定义使用秒s作为单位
  • -w 代表热身ping包的个数,即正式测试前先进行多少次热身测试连接
  • -h 代表最小与最大延迟毫秒数
9ba5f638a9d1dd481ffe029270dc495d.png

另外几个参数解释如下:

  • -i 代表间隔秒数,快ping则设置为0
  • -l 代表ping包大小,默认单位是byte。使用 k为单位代表kilobytes(KB),使用m为单位代表megabytes(MB)
  • -q 代表ping过程中不一个个输出值
  • -t 代表长ping不停
  • -6 代表强制使用IPv6联机

使用TCP ping

执行“psping -? t

PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utilityCopyright (C) 2012-2016 Mark RussinovichSysinternals - www.sysinternals.comTCP ping usage: psping [-t|-n count[s]] [-i interval] [-w count] [-q] [-h [buckets|val1,val2,...]] [-6|-4] destination:port  -t    Ping until stopped with Ctrl+C and type Ctrl+Break        for statistics.  -n    Number of pings or append 's' to specify seconds e.g. '10s'.  -i    Interval in seconds. Specify 0 for fast ping.  -w    Warmup with the specified number of iterations (default is 1).  -q    Don't output during pings.  -h    Print histogram (default bucket count is 20).        If you specify a single argument, it's interpreted as a bucket        count and the histogram will contain that number of        buckets covering the entire time range of values.        Specify a comma-separated list of times to create a custom        histogram (e.g. "0.01,0.05,1,5,10").  -4    Force using IPv4.  -6    Force using IPv6.For high-speed ping tests use -q and -i 0.

与ping功能相同的参数定义:

  • -n 代表正式ping包的个数,或者定义使用秒s作为单位
  • -w 代表热身ping包的个数,即正式测试前先进行多少次热身测试连接
  • -h 代表最小与最大延迟毫秒数
  • -i 代表间隔秒数,快ping则设置为0
  • -l 代表ping包大小,默认单位是byte。使用 k为单位代表kilobytes(KB),使用m为单位代表megabytes(MB)
  • -q 代表ping过程中不一个个输出值
  • -t 代表长ping不停
  • -4 代表强制使用IPv4联机
  • -6 代表强制使用IPv6联机
bc60d3342dc18f4642264a29b2873048.png

延迟测试

执行“psping -? l

PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utilityCopyright (C) 2012-2016 Mark RussinovichSysinternals - www.sysinternals.comTCP and UDP latency usage:server: psping [-6|-4] [-f] -s address:portclient: psping -l requestsize[k|m] -n count[s] [-r] [-u] [-w count] [-f] [-h [buckets|val1,val2,...]] [-6|-4] destination:port  -l    Request size. Append 'k' for kilobytes and 'm' for megabytes.  -n    Number of sends/receives. Append 's' to specify seconds e.g. '10s'.  -r    Receive from the server instead of sending.  -u    UDP (default is TCP).  -w    Warmup with the specified number of iterations (default is 5).  -f    Open source firewall port during the run.  -h    Print histogram (default bucket count is 20).        If you specify a single argument, it's interpreted as a bucket        count and the histogram will contain that number of        buckets covering the entire time range of values.        Specify a comma-separated list of times to create a custom        histogram (e.g. "0.01,0.05,1,5,10").  -4    Force using IPv4.  -6    Force using IPv6.  -s    Server listening address and port.The server can serve both latency and bandwidth tests and remains active untilyou terminate it with Control-C.

执行psping -l 1500 -n 300 -h 10 www.qq.com:443

  • -l 1500代表我发送的数据包大小为每个1500 Bytes,TCP联机在Layer 2 Ethernet中的MTU (Maximum Transmission Unit)通常以1500 Bytes为一个单位
  • -n 300代表放松300个封包
246de8254e2c21929b75d7f24b143627.png

带宽测试

PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utilityCopyright (C) 2012-2016 Mark RussinovichSysinternals - www.sysinternals.comTCP and UDP bandwidth usage:server: psping [-6|-4] [-f] -s address:portclient: psping -b -l requestsize[k|m] -n count[s] [-r] [-u [target]] [-i outstanding] [-w count] [-f] [-h [buckets|val1,val2,...]] [-6|-4] destination:port  -b    Bandwidth test.  -l    Request size. Append 'k' for kilobytes and 'm' for megabytes.  -n    Number of sends/receives. Append 's' to specify seconds e.g. '10s'.  -r    Receive from the server instead of sending.  -u    UDP (default is TCP). Specify target bandwidth in MB/s.  -i    Number of outstanding I/Os (default is min of 16 and 2x CPU cores).  -w    Warmup for the specified iterations (default is 2x CPU cores).  -f    Open source firewall port during the run.  -h    Print histogram (default bucket count is 20).        If you specify a single argument, it's interpreted as a bucket        count and the histogram will contain that number of        buckets covering the entire time range of values.        Specify a comma-separated list of times to create a custom        histogram (e.g. "0.01,0.05,1,5,10").  -4    Force using IPv4.  -6    Force using IPv6.  -s    Server listening address and port.The server can serve both latency and bandwidth tests and remains active untilyou terminate it with Control-C.

执行psping -b -l 1500 -n 15000 www.qq.com:443

  • -b 代表将进行带宽测试
  • -l 1500代表使用大小1500Bytes的数据包
  • -n 15000代表使用15000个数据包
78d4f9e210c74c9d88a58a4d6aa96387.png

同功能的tcping工具

  还有一个在禁止ping的情况下可以在windows上部署tcping64.exe或者tcping.exe工具来检测服务器端口是否开放windows下【tcping工具下载:https://elifulkerson.com/projects/tcping.php】,执行命令“tcping -t www.baidu.com 443

473ea6b7ad2ec2cedca073ec9a327a94.png

总结

  1. 当发现当前做法有不方便时就是寻找更好解决方案的时候。
  2. 上面这些命令,相信在很多判断网络的场景很常用,以后可以happy了。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值