学习使用PSTools工具中的psping

初识PsTools

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

其中包含的工具简介以下:windows

命令名 命令用途
PsExec 远程执行进程
PsFile 显示远程打开的文件
PsGetSid 显示计算机或用户的 SID
PsInfo 列出有关系统的信息
PsKill 按名称或进程 ID 终止进程
PsList 列出有关进程的详细信息
PsLoggedOn 查看在本地经过资源共享(包含全部资源)登陆的用户
PsLogList 转储事件日志记录
PsPasswd 更改账户密码
PsService 查看和控制服务
PsShutdown 关闭并从新启动(可选)计算机
PsSuspend 暂停进程
PsUptime 最后重启后系统运行的时间
psping ICMP 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.comapp

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

另外几个参数解释以下:tcp

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

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:443code

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

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

5.同功能的tcping工具

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

总结

  1. 当发现当前作法有不方便时就是寻找更好解决方案的时候。
  2. 上面这些命令,相信在不少判断网络的场景很经常使用,之后能够happy了。
相关文章
相关标签/搜索