学习使用PSTools工具中的psping

摘要:
该目录首次引入PsToolspsping1.使用ICMPPing2.使用TCPping 3.延迟测试4.带宽测试5.tcping工具的相同功能摘要。当我们第一次学习PsTools时,我们都想检测IP是否可以连接。基本上,我们使用了ping命令,但有些服务器禁用了ping,有时我们想检测IP的端口是否可以连接。所以我发现其中的“psping”命令非常适合我的需求。查看帮助信息PsPingv2.10-PsPing-ping、延迟、带宽测量工具版权所有2012-2016MarkRussinovichSysinternalswww.syninternals。comPsPing实现Ping功能、TCPping、UDP/TCPPlatiny和UDP/TCPbandwidthmeasurement。帮助信息:psping-?

目录

初识PsTools

    在工作中我们都会想探测某个IP是否能通,基本上都使用过ping命令,但是某些服务器禁用了ping,而且有些时候也想探测某个IP的某个端口是否能通。之前的我一般都是用“telnet ip port”,但是我发现一个不好的体验就是没啥明显的结果,不通的时候会超时要等一下下,通的时候也没啥友好的提示。所以就搜到了【PStools下载】,里面的“psping”命令就很适合我这个要求。
    PsTools是一款非常好用的远程管理工具应用软件,PsTools软件为用户提供了非常强大的功能,支持远程打开文件、终止进程、关闭重启计算机等。非常的实用。

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

命令名命令用途
PsExec远程执行进程
PsFile显示远程打开的文件
PsGetSid显示计算机或用户的 SID
PsInfo列出有关系统的信息
PsKill按名称或进程 ID 终止进程
PsList列出有关进程的详细信息
PsLoggedOn查看在本地通过资源共享(包含所有资源)登录的用户
PsLogList转储事件日志记录
PsPasswd更改帐户密码
PsService查看和控制服务
PsShutdown关闭并重新启动(可选)计算机
PsSuspend暂停进程
PsUptime最后重启后系统运行的时间
pspingICMP Ping、TCP Ping、延迟测试、带宽测试
psping

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

PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
Copyright (C) 2012-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

PsPing implements Ping functionality, TCP ping, UDP/TCP latency, and UDP / TCP
bandwidth 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.

1.使用ICMP ping

    执行“psping -? i

PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
Copyright (C) 2012-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

ICMP 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 代表最小与最大延迟毫秒数
    学习使用PSTools工具中的psping第1张

另外几个参数解释如下:

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

2.使用TCP ping

    执行“psping -? t

PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
Copyright (C) 2012-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

TCP 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联机

学习使用PSTools工具中的psping第2张

3.延迟测试

    执行“psping -? l

PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
Copyright (C) 2012-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

TCP and UDP latency usage:
server: psping [-6|-4] [-f] -s address:port
client: 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 until
you 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个封包

学习使用PSTools工具中的psping第3张

4.带宽测试

PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
Copyright (C) 2012-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

TCP and UDP bandwidth usage:
server: psping [-6|-4] [-f] -s address:port
client: 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 until
you terminate it with Control-C.

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

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

执行结果显示我的PC和www.qq.com之间带宽为:526.12 KB/s
学习使用PSTools工具中的psping第4张

5.同功能的tcping工具

    还有一个在禁止ping的情况下可以在windows上部署tcping64.exe或者tcping.exe工具来检测服务器端口是否开放windows下【tcping工具下载】,执行命令“tcping -t www.baidu.com 443
学习使用PSTools工具中的psping第5张

总结
  1. 当发现当前做法有不方便时就是寻找更好解决方案的时候。
  2. 上面这些命令,相信在很多判断网络的场景很常用,以后可以happy了。

免责声明:文章转载自《学习使用PSTools工具中的psping》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Sublime Text关闭自动更新VS的基本设置下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

关于Tcpdump抓包总结

一、简介 tcpdump是一个用于截取网络分组,并输出分组内容的工具。凭借强大的功能和灵活的截取策略,使其成为类UNIX系统下用于网络分析和问题排查的首选工具 tcpdump提供了源代码,公开了接口,因此具备很强的可扩展性,对于网络维护和入侵者都是非常有用的工具 tcpdump 支持针对网络层、协议、主机、网络或端口的过滤,并提供and、or、not等逻辑...

信息安全期末复习

一、米特尼克的圣诞攻击 1、攻击背景 在Unix世界中,可以很容易地给予信任。 假设用户在机器A和机器B上都有一个帐户,为了使两者之间的麻烦最小,就可以在它们之间建立全双工的信任关系。 在A的主目录中,创建一个 .rhosts 文件:echo "hostB 用户名" > .rhosts,在B的主目录中做同样的操作,现在,用户可以使用任何 r* 命令来...

TCP连接与HTTP请求

  一道经典面试题: 从 URL 在浏览器被被输入到页面展现的过程中发生了什么? 相信大多数准备过的同学都能回答出来,但是如果继续问:收到的 HTML 如果包含几十个图片标签,这些图片是以什么方式、什么顺序、建立了多少连接、使用什么协议被下载下来的呢? 一个 TCP 连接可以发多个 HTTP 请求? 要搞懂这个问题,需要先解决下面五个问题: 现代浏览...

一次erlang 节点CPU严重波动排查

  新服务上线后观察到,CPU在10 ~ 70%间波动严重,但从每秒业务计数器看业务处理速度很平均。   接下来是排查步骤:   1. dstat -tam      大概每10s一个周期,网络流量开始变得很小,随后突然增大,CPU也激增。   网络流量变化和从性能计数器结果上并不符合,服务相关业务较为复杂,先找出那个业务占用网络流量。   2. ifto...

在qt中用tcp传输xml消息

在qt中用tcp传输xml消息 本文博客链接:http://blog.csdn.net/jdh99,作者:jdh,转载请注明. 环境: 主机:WIN7 开发环境:Qt5 3.1.2 说明: 在tcp上传输xml消息. 协议格式例如以下: 2字节标识(0xc55c,网络序)+2字节预留 +4字节报文内容长度(网络序) + 4字节命令字(网络序)+报...

golang学习之rpc实例

rpc(远程过程调用),可以像调用本地程序一样调用远端服务,rpc分为http方式和tcp连接方式,使用http的rpc调用如下: 首先是server端: // rpc_server project main.go package main import ( "fmt" "net" "net/http" "n...