您当前的位置:首页 > 计算机 > 软件应用 > 网络应用

【kali-2021.1】FPING—参数中文版(下)

时间:04-15来源:作者:点击数:
12.设置数据包的服务类型(tos)
  • -O, --tos=N 在ICMP数据包上设置服务类型(tos),N可以是十进制或十六进制(0xh)格式

下面是几个tos的报文抓取截图

┌──(kali㉿kali)-[~]
└─$ fping -O 000 172.16.1.111 
172.16.1.111 is alive
在这里插入图片描述
┌──(kali㉿kali)-[~]
└─$ fping -O 001 172.16.1.111
172.16.1.111 is alive
在这里插入图片描述
┌──(kali㉿kali)-[~]
└─$ fping -O 101 172.16.1.111
172.16.1.111 is alive
在这里插入图片描述
┌──(kali㉿kali)-[~]
└─$ fping -O 111 172.16.1.111
172.16.1.111 is alive
在这里插入图片描述
13.显示存活的主机
  • -a, --alive 显示存活的主机
┌──(kali㉿kali)-[~]
└─$ fping  -g 172.16.1.101/28  -A -m -q -a                               
172.16.1.102
172.16.1.103
172.16.1.104
172.16.1.105
172.16.1.106
172.16.1.108
172.16.1.109
14.显示目标IP/IPv6地址
  • -A, --addr 显示目标地址
┌──(kali㉿kali)-[~]
└─$ fping -m  -A www.baidu.com                                                         
119.63.197.151 is alive
119.63.197.139 is alive

┌──(kali㉿kali)-[~]
└─$ fping -m  -A www.tencent.com                                                       
150.109.206.154 is alive
150.109.206.166 is alive

┌──(kali㉿kali)-[~]
└─$ fping -m  -A www.google.com                                                       
2404:6800:4004:800::2004: error while sending ping: Network is unreachable
172.217.175.228 is alive
2404:6800:4004:800::2004 is unreachable
15.指定发送ping的次数,并显示详细信息
  • -C, --vcount=N 与-c相同,显示详细格式的结果
┌──(kali㉿kali)-[~]
└─$ fping -m  -A -C 1 www.tencent.com                                                     
150.109.206.154 : [0], 64 bytes, 56.5 ms (56.5 avg, 0% loss)
150.109.206.166 : [0], 64 bytes, 57.1 ms (57.1 avg, 0% loss)

150.109.206.154 : 56.5
150.109.206.166 : 57.1
16.在输出结果之前打印时间戳
  • -D, --timestamp 在每个输出行之前打印时间戳

假如单独使用-D选项,会报错

┌──(kali㉿kali)-[~]
└─$ fping -C 2 www.tencent.com -D                                                     
[1615385432.44362] www.tencent.com : [0], 64 bytes, 53.6 ms (53.6 avg, 0% loss)
[1615385433.43608] www.tencent.com : [1], 64 bytes, 54.1 ms (53.8 avg, 0% loss)

www.tencent.com : 53.6 54.1
17.显示icmp数据包往返时间
  • -e, --elapsed 显示返回数据包经过的时间
┌──(kali㉿kali)-[~]
└─$ fping  www.tencent.com -e                                                         
www.tencent.com is alive (50.6 ms)
18.显示主机名
  • -n, --name 显示目标主机名(与-d等效)
┌──(kali㉿kali)-[~]
└─$ fping  -n 172.16.1.103                                                               
laptop-ol7jdh0q.int.kcg.ac.jp is alive
19.安静模式
  • -q, --quiet 安静模式( 不显示每个ping结果,仅显示最终摘要, 也不显示ICMP错误消息)
┌──(kali㉿kali)-[~/桌面]
└─$ fping 172.16.1.103                                                                 
172.16.1.103 is alive
                                                                                                             
┌──(kali㉿kali)-[~/桌面]
└─$ fping 172.16.1.103 -q    
20.打印最终统计信息
  • -s, --stats 打印最终统计信息
┌──(kali㉿kali)-[~/桌面]
└─$ fping 172.16.1.103 -s                                                             
172.16.1.103 is alive

       1 targets
       1 alive
       0 unreachable
       0 unknown addresses

       0 timeouts (waiting for response)
       1 ICMP Echos sent
       1 ICMP Echo Replies received
       0 other ICMP received

 0.213 ms (min round trip time)
 0.213 ms (avg round trip time)
 0.213 ms (max round trip time)
        0.000 sec (elapsed real time)
21.显示不可达目标
  • -u, --unreach 显示无法达到的目标

(-a和-u选项不能同时出现在一条命令中。下面的示例可以和-a的示例相比较)

┌──(kali㉿kali)-[~]
└─$ fping  -g 172.16.1.101/28  -A -m -q -u                               
172.16.1.97
172.16.1.98
172.16.1.99
172.16.1.100
172.16.1.101
172.16.1.107
172.16.1.110
22.显示fping版本
  • -v, --version 显示fping版本
┌──(kali㉿kali)-[~/桌面]
└─$ fping -v                                                                           
fping: Version 5.0
23.显示> = N个主机是否可访问
  • -x, --reachable=N 显示> = N个主机是否可访问
┌──(kali㉿kali)-[~/桌面]
└─$ fping  -g 172.16.1.0/24  -A -m -q -a -x 22                                         
172.16.1.2
172.16.1.21
172.16.1.22
172.16.1.24
172.16.1.28
172.16.1.30
172.16.1.31
172.16.1.102
172.16.1.103
172.16.1.105
172.16.1.106
172.16.1.111
172.16.1.112
172.16.1.114
172.16.1.117
172.16.1.118
172.16.1.120
172.16.1.121
172.16.1.122
172.16.1.135
172.16.1.210
172.16.1.241
Enough hosts reachable (required: 22, reachable: 22)
                                                                                                             
┌──(kali㉿kali)-[~/桌面]
└─$ fping  -g 172.16.1.0/29  -A -m -q -a -x 3                                         
172.16.1.2
Not enough hosts reachable (required: 3, reachable: 1)
24.-N和-Q
  • -N, --netdata 与netdata兼容的输出(需要-l -Q)
  • -Q, --squiet=SECS 与-q相同,但是每n秒显示一次摘要
┌──(kali㉿kali)-[~]
└─$ fping 172.16.1.110 -l -Q 5 -N                                         
CHART fping.172_16_1_110_packets '' 'FPing Packets for host 172.16.1.110' packets '172_16_1_110' fping.packets line 110020 5
DIMENSION xmt sent absolute 1 1
DIMENSION rcv received absolute 1 1
BEGIN fping.172_16_1_110_packets
SET xmt = 5
SET rcv = 5
END
CHART fping.172_16_1_110_quality '' 'FPing Quality for host 172.16.1.110' percentage '172_16_1_110' fping.quality area 110010 5
DIMENSION returned '' absolute 1 1
BEGIN fping.172_16_1_110_quality
SET returned = 100
END
CHART fping.172_16_1_110_latency '' 'FPing Latency for host 172.16.1.110' ms '172_16_1_110' fping.latency area 110000 5
DIMENSION min minimum absolute 1 1000000
DIMENSION max maximum absolute 1 1000000
DIMENSION avg average absolute 1 1000000
BEGIN fping.172_16_1_110_latency
SET min = 363075
SET avg = 428782
SET max = 564082
END
BEGIN fping.172_16_1_110_packets
SET xmt = 5
SET rcv = 5
END
BEGIN fping.172_16_1_110_quality
SET returned = 100
END
BEGIN fping.172_16_1_110_latency
SET min = 270521
SET avg = 373692
SET max = 417305
END
^C172.16.1.110 : xmt/rcv/%loss = 11/11/0%, min/avg/max = 0.271/0.410/0.564
25.显示累计中断时间
  • -o, --outage 显示累计中断时间(丢失的数据包/报文时间间隔)
┌──(kali㉿kali)-[~]
└─$ fping 172.16.1.110 -l -o        
172.16.1.110 : [0], 64 bytes, 0.386 ms (0.386 avg, 0% loss)
172.16.1.110 : [1], 64 bytes, 0.633 ms (0.509 avg, 0% loss)
172.16.1.110 : [2], 64 bytes, 0.447 ms (0.489 avg, 0% loss)
172.16.1.110 : [3], 64 bytes, 0.362 ms (0.457 avg, 0% loss)
^C
172.16.1.110 : xmt/rcv/%loss = 4/4/0%, outage(ms) = 0, min/avg/max = 0.362/0.457/0.633
在这里插入图片描述
26.设置ping数据包到一个目标的时间间隔
  • -p, --period=MSEC 设置ping数据包到一个目标的时间间隔(单位:毫秒) (在循环和计数模式下,默认值:1000ms = 1s)

下面将ping数据包的时间间隔设置为0.001秒,同时使用-o选项。通过结果可以看到,fping的速度非常快,以至于在第4,20,30,33,42次ping时,因为时间过短,导致超时丢包。在最后统计时outage(ms) = 5。

┌──(kali㉿kali)-[~]
└─$ fping 172.16.1.114 -l -p 1 -o                                         
172.16.1.114 : [0], 64 bytes, 0.581 ms (0.581 avg, 0% loss)
172.16.1.114 : [1], 64 bytes, 0.433 ms (0.507 avg, 0% loss)
172.16.1.114 : [2], 64 bytes, 0.514 ms (0.509 avg, 0% loss)
172.16.1.114 : [3], 64 bytes, 0.625 ms (0.538 avg, 0% loss)
172.16.1.114 : [4], timed out (0.538 avg, 20% loss)
172.16.1.114 : [5], 64 bytes, 0.468 ms (0.524 avg, 16% loss)
172.16.1.114 : [6], 64 bytes, 0.539 ms (0.527 avg, 14% loss)
172.16.1.114 : [7], 64 bytes, 0.507 ms (0.524 avg, 12% loss)
172.16.1.114 : [8], 64 bytes, 0.991 ms (0.582 avg, 11% loss)
172.16.1.114 : [9], 64 bytes, 0.502 ms (0.573 avg, 10% loss)
172.16.1.114 : [10], 64 bytes, 0.504 ms (0.566 avg, 9% loss)
172.16.1.114 : [11], 64 bytes, 0.508 ms (0.561 avg, 8% loss)
172.16.1.114 : [12], 64 bytes, 0.624 ms (0.566 avg, 7% loss)
172.16.1.114 : [13], 64 bytes, 0.503 ms (0.562 avg, 7% loss)
172.16.1.114 : [14], 64 bytes, 0.486 ms (0.556 avg, 6% loss)
172.16.1.114 : [15], 64 bytes, 0.676 ms (0.564 avg, 6% loss)
172.16.1.114 : [16], 64 bytes, 0.486 ms (0.559 avg, 5% loss)
172.16.1.114 : [17], 64 bytes, 0.474 ms (0.554 avg, 5% loss)
172.16.1.114 : [18], 64 bytes, 0.473 ms (0.550 avg, 5% loss)
172.16.1.114 : [19], 64 bytes, 0.554 ms (0.550 avg, 5% loss)
172.16.1.114 : [20], timed out (0.550 avg, 9% loss)
172.16.1.114 : [21], 64 bytes, 0.922 ms (0.569 avg, 9% loss)
172.16.1.114 : [22], 64 bytes, 0.516 ms (0.566 avg, 8% loss)
172.16.1.114 : [23], 64 bytes, 0.580 ms (0.567 avg, 8% loss)
172.16.1.114 : [24], 64 bytes, 0.469 ms (0.562 avg, 8% loss)
172.16.1.114 : [25], 64 bytes, 0.461 ms (0.558 avg, 7% loss)
172.16.1.114 : [26], 64 bytes, 0.735 ms (0.565 avg, 7% loss)
172.16.1.114 : [27], 64 bytes, 0.926 ms (0.579 avg, 7% loss)
172.16.1.114 : [28], 64 bytes, 0.556 ms (0.578 avg, 6% loss)
172.16.1.114 : [29], 64 bytes, 0.875 ms (0.589 avg, 6% loss)
172.16.1.114 : [30], timed out (0.589 avg, 9% loss)
172.16.1.114 : [31], 64 bytes, 0.484 ms (0.585 avg, 9% loss)
172.16.1.114 : [32], 64 bytes, 0.854 ms (0.594 avg, 9% loss)
172.16.1.114 : [33], timed out (0.594 avg, 11% loss)
172.16.1.114 : [34], 64 bytes, 0.454 ms (0.590 avg, 11% loss)
172.16.1.114 : [35], 64 bytes, 0.603 ms (0.590 avg, 11% loss)
172.16.1.114 : [36], 64 bytes, 0.552 ms (0.589 avg, 10% loss)
172.16.1.114 : [37], 64 bytes, 0.524 ms (0.587 avg, 10% loss)
172.16.1.114 : [38], 64 bytes, 0.859 ms (0.595 avg, 10% loss)
172.16.1.114 : [39], 64 bytes, 0.434 ms (0.590 avg, 10% loss)
172.16.1.114 : [40], 64 bytes, 0.523 ms (0.589 avg, 9% loss)
172.16.1.114 : [41], 64 bytes, 0.987 ms (0.599 avg, 9% loss)
172.16.1.114 : [42], timed out (0.599 avg, 11% loss)
^C
172.16.1.114 : xmt/rcv/%loss = 43/38/11%, outage(ms) = 5, min/avg/max = 0.433/0.599/0.991

-R, --random 随机分组数据(为了阻止链路数据压缩),代替全0作为分组数据,将ping生成随机字节, 来阻止像链路数据压缩的情形。

27.设置源IP地址
  • -S, --src=IP 设置源IP地址

当主机中存在多个IP地址时,可以用-S选项选择源地址。后面只能跟IP/IPv6地址,不能写网卡名。

┌──(kali㉿kali)-[~]
└─$ fping --src=172.16.1.104 172.16.1.111                                 
172.16.1.111 is alive
28.危险参数

-i, --interval=MSEC 定义发送ping数据包之间的间隔(默认值:10ms)

-r, --retry=N ping重试次数 (默认值: 3)

-t, --timeout=MSEC 设置ping到单个目标IP初始超时时间。 (默认: 500 ms,但 -l/-c/-C除外, 其中-p周期最长为2000ms)

以上三个选项有操作风险。例如给-i和-t设置了一个较低值,给-r设置了一个较高的值。如下所示。

  • -i 当 n < 10 毫秒
  • -r 当 n > 20 毫秒
  • -t 当 n < 250 毫秒

这三个操作可能会导致网络大量泛洪等问题。因此建议网络管理员在安装fping时,设置只有root用户才能运行fping,以防止普通用户访问时错误使用fping。

以上。

参考文献

FPING MAN

fping(8) - Linux man page

FPING(8)

Fping – A High Performance Ping Tool for Linux

方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门