2024年3月30日发(作者:)

Fping命令详解

(十大特色功能)

Ping是最常用的网络测试工具,ping的测试功能其实比较多,xp系统的ping有

12个选项。但是,fping测试工具有25个选项,在ping的基础上增加了许多专业的功

能,可用于更深层次的网络测试和检测。

Fping是免费软件,可从下载。

本文翻译和总结了fping的参数,以及使用方法、命令举例,以及总结除了fping

的十个特色功能,仅供参考。尤其是抖动测试,是目前网络中能找到的唯一的简单测试

时延的网络工具软件。

一、版本

Fastpingerversion3.00

(c)WouterDhondt()

二、参数Usage:

fping[-sdata_size][-Ssize1/size2][-c][-ttime][-w

timeout]

[-ncount][-hTTL][-vTOS][-rroutes][-Rmin/max][-a][-f]

[-b(-)][-i][-l][-o][-j][-T][-D][-dping_data][-ghost1/host2]

[-Hfilename][-Lfilename]

三、十大特色功能

1.(限定间隔)指定数据包间隔大小,从2ms到1000000ms。实际命令是可以从

1ms到1000000ms(16分钟)

2.跳数扫描,通过指定-h选项,可以判断跳数范围。

3.可以通过-v选项指定ping数据包的ToS值,相当于可以发出指定ToS的ping

数据包。

4.可以通过-r选项打印ping数据包经过的路由。

5.(测试抖动)可以通过-j选项测试网络抖动性能,同时能兼容测试丢包情况。

1

6.可以通过-g选项,一次连续ping多个地址。

7.可以通过-i指定数据包所采用的协议为ICMP,而不是IP包。

8.可以通过-T和-D选项打印时间戳和日期戳。

9.可以通过-l和-o选项,控制输出信息的复杂程度,可以选择只输出统计信

息。

10.可以通过-L选项将ping信息输出到文件。

四、选项Options:

1.-s:data_sizeinbytesupto65500,指定数据包大小,最大可到65500Byte,

命令举例:C:>fping192.0.0.64-s65500

Reply[1]from192.0.0.64:bytes=65500time=8.9msTTL=64

Reply[2]from192.0.0.64:bytes=65500time=8.4msTTL=64

Reply[3]from192.0.0.64:bytes=65500time=8.3msTTL=64

Reply[4]from192.0.0.64:bytes=65500time=8.2msTTL=64

Pingstatisticsfor192.0.0.64:

Packets:Sent=4,Received=4,Lost=0(0%loss)

Approximateroundtriptimesinmilli-seconds:

Minimum=8.2ms,Maximum=8.9ms,Average=8.4ms

2.-t:timebetween2pingsinmsupto1000000,指定ping的数据包时间

间隔大小,时间越小,单位时间内发出去的包越多,最大为16分钟。用1ms(fping

192.0.0.64-t1-c)的间隔ping数据包可测试业务倒换时间(注意外加-c

选项),例如在测试双路由的情况下,从网管主机ping对端,可大致测试业务

中断时间和恢复时间。

命令举例:C:>fping192.0.0.64-t1

Pinging192.0.0.64with32bytesofdataevery1ms:

Reply[1]from192.0.0.64:bytes=32time=9.0msTTL=64

Reply[2]from192.0.0.64:bytes=32time=0.4msTTL=64

Reply[3]from192.0.0.64:bytes=32time=0.3msTTL=64

Reply[4]from192.0.0.64:bytes=32time=0.3msTTL=64

2

Pingstatisticsfor192.0.0.64:

Packets:Sent=4,Received=4,Lost=0(0%loss)

Approximateroundtriptimesinmilli-seconds:

Minimum=0.3ms,Maximum=9.0ms,Average=2.5ms

3.-w:timeoutinmstowaitforeachreply

目前的测试,此选项不生效。

4.-c:continuousping(higherprioritythan-n),持续ping包,直到CTRL+C

(Control-C)终止。配合-t、-s等选项使用更当。通过Control-Break可

暂停ping包,按任意键可继续。

命令举例:C:>fping192.0.0.64-c

5.n:numberofpingstosendtoeachhost。Ping指定数量的包。n值可无

限大。

命令举例:C:>fping192.0.0.64-n999999999

6.-S:sizesweep:pingwithsize1,size1+1,...,size2bytes

目前的测试,此选项不生效。

7.-R:randomlengthbetweenminandmax(disabledwhenusing-S)

目前的测试,此选项不生效。

8.-d:pingwithspecifieddata。可以通过-d选项,指定数据包内容。中间

不能有空格,空格之后的内容会忽略。

命令举例:C:>fping192.0.0.64-d1234567890

9.-h:numberofhops(TTL:1to128)+printhops。可以通过-h指定条

数,如果目的地址在指定范围减1范围之内,可以ping通,否则不同。使用

-h从1开始累加,可以实现一个跳数扫描功能,可以检测一个地址在ping发

3

出主机的多少hops范围之内。例如fping192.0.0.64-h1,2,3,4,5,

6。直到ping通为止,可以判断出目的主机的hops范围。

10.-v:TypeOfService(0to255)(IPv4-only),可以指定ping包的优先级

别。

命令举例:C:>fping192.0.0.64-v4

Pinging192.0.0.64with32bytesofdataevery1000ms:

Reply[1]from192.0.0.64:bytes=32time=0.5msTTL=64TOS=4

Reply[2]from192.0.0.64:bytes=32time=0.4msTTL=64TOS=4

Reply[3]from192.0.0.64:bytes=32time=0.4msTTL=64TOS=4

Reply[4]from192.0.0.64:bytes=32time=0.4msTTL=64TOS=4

Pingstatisticsfor192.0.0.64:

Packets:Sent=4,Received=4,Lost=0(0%loss)

Approximateroundtriptimesinmilli-seconds:

Minimum=0.4ms,Maximum=0.5ms,Average=0.4m

11.-r:recordroute(1to9routes)(IPv4-only),打印ping数据包经过的

路由,数值范围是1-9。

命令举例:C:>fping192.0.0.64-r1

Pinging192.0.0.64with32bytesofdataevery1000ms:

Reply[1]from192.0.0.64:bytes=32time=0.3msTTL=64

Route:192.0.0.64

Reply[2]from192.0.0.64:bytes=32time=0.3msTTL=64

Route:192.0.0.64

Reply[3]from192.0.0.64:bytes=32time=0.3msTTL=64

Route:192.0.0.64

Reply[4]from192.0.0.64:bytes=32time=0.4msTTL=64

Route:192.0.0.64

4

12.-f:setDon'tFragmentflaginpacket(IPv4-only),不做帧分割处理。

如果与-s选项配合使用,可检测所在物理环境的mtu大小。

命令举例:C:>fping

C:>fping

192.0.0.64-f-s1473结果如下:

192.0.0.64-f-s1473

PacketsizeexceedsMTUandneedstobefragmentedbutDFset.

PacketsizeexceedsMTUandneedstobefragmentedbutDFset.

PacketsizeexceedsMTUandneedstobefragmentedbutDFset.

PacketsizeexceedsMTUandneedstobefragmentedbutDFset.

命令举例:C:>fping192.0.0.64-f-s1472结果如下:

Reply[1]from192.0.0.64:bytes=1472time=0.9msTTL=64

Reply[2]from192.0.0.64:bytes=1472time=1.0msTTL=64

Reply[3]from192.0.0.64:bytes=1472time=0.9msTTL=64

Reply[4]from192.0.0.64:bytes=1472time=0.9msTTL=64

通过上述测试命令可知,所在网络环境的MTU为1472。

13.-j:printjitterwitheachreply(onlywhenpingingonehost),显示

所在网络环境的抖动性能。

命令举例:C:>fping192.0.0.64-t1-j结果如下:

Reply[1]from192.0.0.64:bytes=32time=0.5msTTL=64jitter=0.00ms

Reply[2]from192.0.0.64:bytes=32time=0.4msTTL=64jitter=0.01ms

Reply[3]from192.0.0.64:bytes=32time=0.3msTTL=64jitter=0.01ms

Reply[4]from192.0.0.64:bytes=32time=0.3msTTL=64jitter=0.01ms

14.-g:pingIPrangefromhost1tohost2(IPv4-only)

命令举例:fping192.0.0.63192.0.0.64-g结果如下:

Pingingmultiplehostswith32bytesofdataevery1000ms:

Reply[1]from192.0.0.63:bytes=32time=0.2msTTL=64

Reply[2]from192.0.0.64:bytes=32time=10.1msTTL=64

Pingstatisticsformultiplehosts:

5

Packets:Sent=2,Received=2,Lost=0(0%loss)

Approximateroundtriptimesinmilli-seconds:

Minimum=0.2ms,Maximum=10.1ms,Average=5.1ms

15.-H:gethostsfromfilename(commadelimited,filenamewithfullpath),

从一个文本文件中获取主机地址,文本文件中只需要包含主机地址。

命令举例:-n5结果如下:

Reply[1]from192.0.0.64:bytes=32time=0.4msTTL=64

Reply[2]from192.0.0.64:bytes=32time=0.3msTTL=64

Reply[3]from192.0.0.63:bytes=32time=0.1msTTL=64

Reply[4]from192.168.0.234:bytes=32time=14.6msTTL=64

Reply[5]from192.168.0.233:bytes=32time=0.1msTTL=64

16.-a:resolveaddressestohostnames,将一个IP地址解析为主机名称,并

进行ping测试。

命令举例:fping192.0.0.63-a本机地址为192.0.0.63,本机计算机名

称为:20120302-1704,结果如下:

Pinging20120302-1704[192.0.0.63]with32bytesofdataevery1000ms:

Reply[1]from192.0.0.63:bytes=32time=0.2msTTL=64

Reply[2]from192.0.0.63:bytes=32time=0.1msTTL=64

Reply[3]from192.0.0.63:bytes=32time=0.2msTTL=64

Reply[4]from192.0.0.63:bytes=32time=0.2msTTL=64

17.-A:printaddresseswitheachreply

18.-p:useathreadpooltopingmultiplehosts(enablesICMPdll),在

一个线程中ping多个主机。-p5,每一个核心5个线程。

命令举例:fping192.0.0.64-p-t10-n20结果如下:

Reply[1]from192.0.0.64:bytes=32time=0.4msTTL=64

6

Reply[2]from192.0.0.64:bytes=32time=0.3msTTL=64

Reply[3]from192.0.0.64:bytes=32time=0.3msTTL=64

Reply[4]from192.0.0.64:bytes=32time=0.4msTTL=64

19.-i:useICMPdllinsteadofrawsocket(disables-r),使用ICMP协议

发出数据包,不使用IP包方式,可通过扫描软件发现数据包协议为ICMP。

命令举例:fping192.0.0.64-i

20.-b:beeponeverysuccessfulreply(-b-tobeepontimeout),每成功

一次蜂鸣一声。

命令举例:fping192.0.0.64-b

21.-T:printtimestampwitheachreply,每次ping完成后打印时间戳。

命令举例:fping192.0.0.64-T-t10-n100

14:42:14.796:Reply[1]from192.0.0.64:bytes=32time=0.4msTTL=64

14:42:14.812:Reply[2]from192.0.0.64:bytes=32time=0.4msTTL=64

14:42:14.828:Reply[3]from192.0.0.64:bytes=32time=0.4msTTL=64

14:42:14.828:Reply[4]from192.0.0.64:bytes=32time=0.4msTTL=64

14:42:14.843:Reply[5]from192.0.0.64:bytes=32time=0.4msTTL=64

22.-D:printdatestampwitheachreply,每次ping完成后打印日期。

命令举例:fping192.0.0.64-D-t10-n100

2012/12/10:Reply[1]from192.0.0.64:bytes=32time=0.5msTTL=64

2012/12/10:Reply[2]from192.0.0.64:bytes=32time=0.4msTTL=64

2012/12/10:Reply[3]from192.0.0.64:bytes=32time=0.4msTTL=64

23.-l:limittheoutputtopingresultsanderrors,限制输出信息。相当

于输出最简单的,最精简的信息。

命令举例:fping192.0.0.64-l-t10-n40

7

结果如下:

Reply[1]from192.0.0.64:bytes=32time=0.4msTTL=64

Reply[2]from192.0.0.64:bytes=32time=0.4msTTL=64

Reply[3]from192.0.0.64:bytes=32time=0.4msTTL=64

Reply[4]from192.0.0.64:bytes=32time=0.4msTTL=64

Reply[5]from192.0.0.64:bytes=32time=0.3msTTL=64

24.-o:limittheoutputtopingstatistics,只输出统计信息。

命令举例:fping192.0.0.64-o结果如下:

Pinging192.0.0.64with32bytesofdataevery1000ms:

Pingstatisticsfor192.0.0.64:

Packets:Sent=4,Received=4,Lost=0(0%loss)

Approximateroundtriptimesinmilli-seconds:

Minimum=0.4ms,Maximum=4.2ms,Average=1.4ms

25.-L:loggingtoatextfile,将ping的测试信息输出到一个文件。

命令举例:结果如下:

Pinging192.0.0.64with32bytesofdataevery1000ms:

Pingstatisticsfor192.0.0.64:

Packets:Sent=4,Received=4,Lost=0(0%loss)

Approximateroundtriptimesinmilli-seconds:

Minimum=0.4ms,Maximum=0.5ms,Average=0.5ms

二○一二年十二月十日

(待续)

8