ping命令以前是一个很好用并且常用的网络测试工具,它是基于ICMP协议,但是出于网络安全等因素,大部分网络环境以及云环境可能都会禁止ICMP协议,所以在工作中,我们必须掌握一些其他比较流行的网络测试工具,下面分别介绍 tcpping、tcping、psping、hping、paping等几款网络测试工具。

关于ICMP概念:

ICMP是(Internet Control Message Protocol)Internet控制报文协议。它是TCP/IP协议族的一个子协议,用于在IP主机、路由器之间传递控制消息。控制消息是指网络通不通、主机是否可达、路由是否可用等网络本身的消息。这些控制消息虽然并不传输用户数据,但是对于用户数据的传递起着重要的作用。

tcpping介绍

tcpping工具工作在 TCP 层,通过发送伪造的 TCP SYN 包并侦听来自服务器或中间设备返回的 SYN/ACK 或 RST 。代码100多行,源代码在此链接http://www.vdberg.org/richard/tcpping,tcpping需要调用tcptraceroute。打印与ping近乎相同测试结果,目前版本为V1.7,tcping的介绍参考链接http://www.vdberg.org/richard/tcpping.html,这个是Richard van den Berg在2002年编写的,作者当时需要测量TCP往返时间。所以写了这个脚本。tcpping只支持Linux。不支持Windows平台。

tcpping安装

1:tcpping脚本依赖tcptraceroute组件,所以必须先安装tcptraceroute

# yum install tcptraceroute

2:下载tcpping文件

#  wget http://www.vdberg.org/~richard/tcpping

3:将tcpping文件移动到/usr/bin下并授权。

# mv tcpping /usr/bin/
# cd /usr/bin
# chmod 755 tcpping

tcpping测试

tcpping帮助信息。

# tcppingtcpping v1.7 Richard van den Berg <richard@vdberg.org>Usage: tcpping [-d] [-c] [-C] [-w sec] [-q num] [-x count] ipaddress [port]-d   print timestamp before every result          -c   print a columned result line-C   print in the same format as fping's -C option-w   wait time in seconds (defaults to 3)-r   repeat every n seconds (defaults to 1)-x   repeat n times (defaults to unlimited)See also: man tcptraceroute

tcping介绍

tcping也是通过tcp端口工作,tcping还能监听某个端口的状态,注意tcping与tcpping是不同的两款工具,另外tcping也有很多版本。如下所示:

来自 kirchner 源代码的 TCPing

来自 Eli Fulkerson 源代码的 TCPing
Windows

tcping安装

Windows平台:

从https://www.elifulkerson.com/projects/tcping.php下载该工具后。放到C:\Windows\System32目录下即可。无需安装。

Linux平台:

linux平台较多,安装方式也较多,当然最简单的莫过于yum安装。测试感觉Linux下的这款工具功能过于简单。

# yum install tcping

tcping测试

Eli Fulkerson写的Windows下的tcping功能十分强大。参数多到不想去总结,实在是太多了,如果不清楚,每次使用的时候查看帮助文档即可。

C:\Users>tcping www.aliyun.comProbing 140.205.172.20:80/tcp - Port is open - time=2.444msProbing 140.205.172.20:80/tcp - Port is open - time=2.574msProbing 140.205.172.20:80/tcp - Port is open - time=2.965msProbing 140.205.172.20:80/tcp - Port is open - time=4.074msPing statistics for 140.205.172.20:804 probes sent.4 successful, 0 failed.Approximate trip times in milli-seconds:Minimum = 2.444ms, Maximum = 4.074ms, Average = 3.014msC:\Users>tcping www.aliyun.com 80Probing 140.205.172.20:80/tcp - Port is open - time=2.731msProbing 140.205.172.20:80/tcp - Port is open - time=2.126msProbing 140.205.172.20:80/tcp - Port is open - time=2.916msProbing 140.205.172.20:80/tcp - Port is open - time=2.609msPing statistics for 140.205.172.20:804 probes sent.4 successful, 0 failed.Approximate trip times in milli-seconds:Minimum = 2.126ms, Maximum = 2.916ms, Average = 2.595msC:\Users>

Linux:

Linux下的tcping命令功能非常简单,如下所示,感觉没有tcpping或Windows下的tcping功能强大。

Usage: tcping [-q] [-t timeout_sec] [-u timeout_usec] <host> <port>[root@DB-Server ~]# tcping  192.168.27.57 1433192.168.27.57 port 1433 open.

PsPing介绍

下面是官方文档以及Azure官方文档关于PsPing的介绍资料,这些介绍已经全面的阐述了PsPing这款工具:

PsPing implements Ping functionality, TCP ping, latency and bandwidth measurement. Use the following command-line options to show the usage for each test type:

通常,我们测试数据包能否通过IP协议到达特定主机时,都习惯使用 ping 命令。工作时用ping向目标主机发送一个 IMCP Echo 请求的数据包,并等待接收 Echo 响应数据包,通过响应时间和成功响应的次数来估算丢包率和网络时延。但是在 Azure 中ICMP包无法通过防火墙和负载均衡器,所以不能直接使用 ping 来测试 Azure 中的虚拟机和服务的连通性(VPN 和 Express Route 通道中的流量不经过负载均衡器,所以只要链路上的防火墙允许 ICMP 包传递,ping 依然可用)。

为了在 Azure 中进行连通性测试,例如测试 RDP、SSH 端口可用性,或者 HTTP、HTTPS 服务稳定性,甚至测试从 Azure 向外部服务的连接,我们都推荐使用 PsPing 或 PaPing。PsPing 是微软 PSTools 工具套件中的其中一个命令。除了ICMP ping 测试,它主要用来测试 TCP 端口的连通性,还可以测试 TCP/UDP 网络时延和带宽。不过, PsPing 只能在 Windows 中运行。如果您需要在 Linux 中发起 TCP 端口连通性和网路时延的测试,可以使用 PaPing 。PaPing 是一个跨平台的开源工具。它的功能相对 PsPing 而言更简单,只支持 TCP 端口的相关测试,不支持 UDP 端口的测试。

PsPing安装

PSTool工具包可以从微软官方网址下载:https://docs.microsoft.com/zh-cn/sysinternals/downloads/psping 。 解压PSTools.zip包后,将psping.exe拷贝到C:\Windows\System32下,那么你在cmd命令窗口的任意目录都可以使用PsPing命令了。当然你也可以单独将 psping.exe 命令解压出来放在任意路径,然后从命令提示符来运行。只是这样就需要在运行命令前转换到psping.exe所在的路径。

PsPing参数

psping帮助信息查看,如下所示psping四个主要功能的帮助命令,四个功能分别是ICMP Ping、TCP Ping、延迟测试、带宽测试。


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

延迟测试多了参数-r,-u,-f

C:\Users>psping -? lPsPing 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 [bckets|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 bucketcount and the histogram will contain that number ofbuckets covering the entire time range of values.Specify a comma-separated list of times to create a customhistogram (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.

C:\Users>psping -? bPsPing 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 bucketcount and the histogram will contain that number ofbuckets covering the entire time range of values.Specify a comma-separated list of times to create a customhistogram (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.

带宽测试多了-b、-i两个参数。如下所示:

-b 带宽测试

-i 未完成的I/O数量

PsPing测试案例

例子1,例如我要检查服务器的1433端口是否开放

例子2:网络时延测试

C:\Users>psping -n 6 -w 2 -h xxxxxx.database.chinacloudapi.cn:1433PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utilityCopyright (C) 2012-2016 Mark RussinovichSysinternals - www.sysinternals.comTCP connect to 139.219.130.35:1433:8 iterations (warmup 2) ping test:Connecting to 139.xxx.130.xx:1433 (warmup): from 192.168.103.21:57851: 36.10msConnecting to 139.xxx.130.xx:1433 (warmup): from 192.168.103.21:57852: 36.32msConnecting to 139.xxx.130.xx:1433: from 192.168.103.21:57853: 40.33msConnecting to 139.xxx.130.xx:1433: from 192.168.103.21:57854: 34.71msConnecting to 139.xxx.130.xx:1433: from 192.168.103.21:57855: 35.60msConnecting to 139.xxx.130.xx:1433: from 192.168.103.21:57856: 35.74msConnecting to 139.xxx.130.xx:1433: from 192.168.103.21:57858: 40.21msConnecting to 139.xxx.130.xx:1433: from 192.168.103.21:57859: 39.50msTCP connect statistics for 139.xxx.130.xxx:1433:Sent = 6, Received = 6, Lost = 0 (0% loss),Minimum = 34.71ms, Maximum = 40.33ms, Average = 37.68msLatency Count34.71   135.01   035.30   035.60   235.89   036.19   036.49   036.78   037.08   037.37   037.67   037.96   038.26   038.56   038.85   039.15   039.44   139.74   040.03   140.33   1

例子3:网络带宽测试

paping安装测试

paping的下载地址如下,它分Windows和Linux版本。

https://code.google.com/archive/p/paping/downloads


tar -xvf paping_1.5.5_x86-64_linux.tar.gz

解压到任意目录,就可以直接执行。另外paping命令对比psping命令,功能更简单、单一。它只有简单的4个参数。

-p, --port N 指定被测试服务的 TCP 端口(必须);

–nocolor 屏蔽彩色输出;

-t, --timeout 指定超时时长,单位为毫秒,默认值为 1000;

-c, --count N 指定测试次数。

[root@DB-Server tmp]# ./paping -?paping v1.5.5 - Copyright (c) 2011 Mike LovellSyntax: paping [options] destinationOptions:-?, --help     display usage-p, --port N   set TCP port N (required)--nocolor  Disable color output-t, --timeout  timeout in milliseconds (default 1000)-c, --count N  set number of checks to N
[root@DB-Server tmp]# ./paping --nocolor -p 80 -c 10 www.azure.cnpaping v1.5.5 - Copyright (c) 2011 Mike LovellConnecting to 1stcncloud.dtwscachev290.ourwebcdn.com [27.155.71.36] on TCP 80:Connected to 27.155.71.36: time=0.39ms protocol=TCP port=80Connected to 27.155.71.36: time=0.33ms protocol=TCP port=80Connected to 27.155.71.36: time=0.73ms protocol=TCP port=80Connected to 27.155.71.36: time=0.48ms protocol=TCP port=80Connected to 27.155.71.36: time=0.49ms protocol=TCP port=80Connected to 27.155.71.36: time=0.39ms protocol=TCP port=80Connected to 27.155.71.36: time=0.37ms protocol=TCP port=80Connected to 27.155.71.36: time=0.35ms protocol=TCP port=80Connected to 27.155.71.36: time=0.47ms protocol=TCP port=80Connected to 27.155.71.36: time=0.52ms protocol=TCP port=80Connection statistics:Attempted = 10, Connected = 10, Failed = 0 (0.00%)Approximate connection times:Minimum = 0.33ms, Maximum = 0.73ms, Average = 0.45ms

Hping介绍

Hping是一个命令行下使用的TCP/IP数据包组装/分析工具,其命令模式很像Unix下的ping命令,但是它不仅能发送ICMP回应请求,它还可以支持TCP、UDP、ICMP和RAW-IP协议,它有一个路由跟踪模式,能够在两个相互包含的通道之间传送文件。Hping常被用于检测网络和主机,其功能非常强大,可在多种操作系统下运行,如Linux,FreeBSD,NetBSD,OpenBSD,Solaris,MacOs X,Windows。 目前最新的版本为hping3

Hping的主要功能有:

1、防火墙测试

2、高级端口扫描

3、网络检测,可以用不同的协议、服务类型(TOS)、IP分片

4、手工探测MTU( 最大传输单元) 路径

5、先进的路由跟踪,支持所有的协议

6、远程操作系统探测

7、远程的运行时间探测

8、TCP/IP堆栈审计

Hping的官方网址为http://www.hping.org/,开发者为是Salvatore Sanfilippo,官方介绍资料如下:

hping is a command-line oriented TCP/IP packet assembler/analyzer. The interface is inspired to the ping(8) unix command, but hping isn’t only able to send ICMP echo requests. It supports TCP, UDP, ICMP and RAW-IP protocols, has a traceroute mode, the ability to send files between a covered channel, and many other features.

While hping was mainly used as a security tool in the past, it can be used in many ways by people that don’t care about security to test networks and hosts. A subset of the stuff you can do using hping:

· Firewall testing

· Advanced port scanning

· Network testing, using different protocols, TOS, fragmentation

· Manual path MTU discovery

· Advanced traceroute, under all the supported protocols

· Remote OS fingerprinting

· Remote uptime guessing

· TCP/IP stacks auditing

· hping can also be useful to students that are learning TCP/IP.

Hping works on the following unix-like systems: Linux, FreeBSD, NetBSD, OpenBSD, Solaris, MacOs X, Windows.

Hping安装

Hping这个项目在GitHub上,https://github.com/antirez/hping,可以直接从这里下载安装。另外如果yum源有安装程序,使用yum安装最方便、快捷。

# yum install hping3

下面是官方文档的源码安装,不过源码安装需要依赖一些组件,想必yum安装麻烦很多:

Linux


please, follows this steps:


$ ./configure (first try ./configure --help)$ vi Makefile (optional)$ make$ su# make install

FreeBSD, OpenBSD, NetBSD


You will need the libpcap and the gmake utility installed on your system.


$ ./configure$ gmake$ su (or calife)# gmake install

Hping测试

查看hping的帮助信息:

[root@DB-Server ~]# hping3 --help #或者hping --help

下面表格整理了部分参数信息,更多参数信息可以参考帮助文档或http://man.linuxde.net/hping

# hping3  -S 192.168.27.57 -p 1433HPING 192.168.27.57 (eth0 192.168.27.57): S set, 40 headers + 0 data byteslen=44 ip=192.168.27.57 ttl=60 DF id=0 sport=1433 flags=SA seq=0 win=5840 rtt=31.4 mslen=44 ip=192.168.27.57 ttl=60 DF id=0 sport=1433 flags=SA seq=1 win=5840 rtt=23.5 mslen=44 ip=192.168.27.57 ttl=118 DF id=10907 sport=1433 flags=SA seq=2 win=8192 rtt=20.4 mslen=44 ip=192.168.27.57 ttl=118 DF id=10908 sport=1433 flags=SA seq=3 win=8192 rtt=15.6 mslen=44 ip=192.168.27.57 ttl=60 DF id=0 sport=1433 flags=SA seq=4 win=5840 rtt=15.5 mslen=44 ip=192.168.27.57 ttl=60 DF id=0 sport=1433 flags=SA seq=5 win=5840 rtt=14.1 mslen=44 ip=192.168.27.57 ttl=60 DF id=0 sport=1433 flags=SA seq=6 win=5840 rtt=14.4 ms^C--- 192.168.27.57 hping statistic ---7 packets transmitted, 7 packets received, 0% packet lossround-trip min/avg/max = 14.1/19.3/31.4 ms

个人感觉Hping是功能最强大的一款工具,可以测试防火墙功能、端口扫描、Idle扫描、拒绝服务攻击、木马功能,这篇hping3命令已经详细介绍了,而且有些测试不方便展示在此。在此略过细节。另外,工具再好,也需要可以掌握、驾驭工具的人。

参考资料:

https://docs.azure.cn/zh-cn/articles/azure-operations-guide/virtual-network/aog-virtual-network-tcp-psping-paping-connectivity

https://docs.microsoft.com/en-us/sysinternals/downloads/psping

https://www.cmsky.com/tcping/

http://zhjwpku.com/2016/12/17/tcpping-hping-mtr.html

https://www.slashroot.in/what-tcp-ping-and-how-it-usedyouy

http://tookdes.org/geek/archives/tcping-intro.html

http://man.linuxde.net/hping3

几款网络测试工具总结相关推荐

  1. 无线网络优化和软件测试哪个好,你了解你的网络吗——7款网络测试工具简介,帮你优化家庭组网...

    你了解你的网络吗--7款网络测试工具简介,帮你优化家庭组网 2019-06-14 13:54:30 355点赞 4164收藏 165评论 前言 前面陆续发了三篇路由器的开箱简评,老司鸡慢慢也入门了一些 ...

  2. Facebook开源多款AI工具,支持游戏、翻译等

    翻译 | 林椿眄 编辑 | 阿司匹林 出品 | AI科技大本营(公众号ID:rgznai100) 近日,Facebook 在年度开发者大会 F8 上宣布开源多款 AI 工具,除了 PyTorch.Ca ...

  3. 科技公司最常用的50款开源工具,提升你的逼格~

    点击关注上方"视学算法",设为"置顶或星标",第一时间送达技术干货. 本文介绍了多款知名的开源应用软件,科技公司可以用它们来管理自己的 IT 基础设施.开发产品 ...

  4. Jeff Dean:一年开源12款新工具,谷歌负责任AI原则落地生根

    https://www.toutiao.com/a6707804358597149191/ [新智元导读]自从谷歌宣布AI原则开始,已经过了一年时间.如今Jeff Dean和Kent Walker对原 ...

  5. 免费开源、功能完善、暗黑风格,你会拒绝这款SSH工具吗?

    大家好,我是TJ 一个励志推荐10000款开源项目与工具的程序员 这两天TJ君身边的好朋友都在休闲时间玩玩暗黑2重置版,惹得TJ君心里也痒痒的,毕竟TJ君还是很爱这暗黑风格,巧的是这两天有个小伙伴来咨 ...

  6. python开发工具排名-Python程序员必备的四款开发工具

    原标题:Python程序员必备的四款开发工具 每一位Python程序员都会有套工具来应对开发工作上的挑战.多年来,Python程序员使用开发工具来完成他们的工作.有很多工具对他们是有用的,不过对于初入 ...

  7. 快来捡武器:Black Hat USA 将推出的8款安全工具

    7月31日至8月5日期间,Black Hat USA 2021在拉斯维加斯举行.这场为期六天的安全盛会内容涉及信息安全研究.开发和趋势的最新情况等.安全研究人员和从业人员也分享了大量用于渗透测试.逆向 ...

  8. 【转】IAR与Keil两款开发工具区别

    http://www.smzy.com/smzy/tech39675.html IAR及IAR Embedded Workbench,KEIL及Keil MDK-ARM,这两款都是ARM开发工具.那么 ...

  9. 超好用的5款开发工具,Python初习者必看

    很多Python初习者想必都会有如下感悟:最开始学习Python的时候,因为没有去探索好用的工具,吃了很多苦头.后来工作中深刻体会到,合理使用开发的工具的便利和高效.今天,小千就把Python程序员使 ...

  10. python界面开发工具免费_Python程序员必备的四款开发工具

    原标题:Python程序员必备的四款开发工具 Python自学与交流中心QQ群:260308621 大家今晚利用1个小时看python基础视频教程 23-27节 ,自己监督自己.跟着学习哈!一定要做到 ...

最新文章

  1. [知识储备]用RequireJS +zepto开发微信公众号
  2. 基于Bind实现的DNS正反向解析及主从DNS的配置
  3. freebsd ports安装mysql_FreeBSD Ports 方式安装MySQL及注意事项
  4. 2017报计算机热不热,2017年五月份热吗?2017年五月天气热不热?
  5. Codeforces 235B Let's Play Osu!
  6. java调接口传值_关于调用第三方接口时传递参数是File类型的解决方式
  7. mysql 同步 master-slave
  8. Xshell用于windows主机和linux虚拟机之间互传文件
  9. hadoop中4种压缩格式的特征的比较
  10. sublime 中文配置
  11. batch size设置技巧
  12. 使用微信开发者平台调样式
  13. fib matlab,基于MATLAB的FIB制备三维原子探针样品过程的模拟方法与流程
  14. 新冠造成的经济崩溃对女性影响最大
  15. Android获取QQ音乐url,QQ音乐vkey获取,更新播放url
  16. opencv实现实时“无脸男”
  17. 美团点评2020校招笔试 2019.08.22
  18. 哈佛的学生都在看这种视频,每天15分钟,英语水平暴增!
  19. 网络创业者之家:写给新手的互联网创业干货,让你少走弯路
  20. php获取qq群列表,自己获取QQ群列表(上)

热门文章

  1. 谷歌、bing 翻译插件调研总结
  2. Spring Cloud 菜鸟教程 1 简介
  3. 频段、信道带宽、EARFCN、频段和EARFCN之间的换算
  4. 【scratch高阶案例教学】scratch斐波那契数列 scratch创意编程 少儿编程 小朋友们也可以完成如此神奇的数列
  5. 时间表达式java定时器_quartz定时任务时间表达式说明
  6. 特征选择算法(机器学习)
  7. 如龙0pc端与计算机王玩游戏卡住,如龙0游戏停止工作怎么办_游戏未响应闪退解决方法_3DM单机...
  8. 网易云音乐encseckey算法php,[PHP]网易云音乐params计算及直链提取
  9. Windows下LaTeX安装教程与新手入门
  10. 【如何选择到合适的天线-天线参数讲解 】