fping命令

fping是一个用于网络扫描的工具,它可以在 Linux 系统上使用。fping可以发送 ICMP ECHO_REQUEST(即 ping)数据包到指定的网络地址范围,并等待响应。通过这种方式,fping可以用来检测哪些 IP 地址是活跃的。

可以测试多个ip或者域名,并形成报告

[root@localhost ~]# fping 192.168.71.130 qq.com 192.168.71.131
192.168.71.130 is alive
qq.com is alive
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.131
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.131
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.131
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.131
192.168.71.131 is unreachable
  1. 192.168.71.130是可达的(alive)。
  2. qq.com是可达的(alive)。
  3. 对于发送到192.168.71.131的ICMP Echo请求,从192.168.71.130收到了ICMP Host Unreachable错误。
  4. 192.168.71.131是不可达的(unreachable)。

指定范围

这里指定的是192.168.71.130到192.168.71.140在内的所有ip地址,并返回报告

[root@localhost ~]# fping  -s -g 192.168.71.130  192.168.71.140 
192.168.71.130 is alive
192.168.71.132 is alive
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.133
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.133
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.133
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.133
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.131
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.131
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.131
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.131
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.137
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.137
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.137
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.137
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.136
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.136
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.136
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.136
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.135
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.135
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.135
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.135
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.134
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.134
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.134
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.134
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.140
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.140
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.140
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.140
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.139
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.139
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.139
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.139
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.138
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.138
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.138
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.138
192.168.71.131 is unreachable
192.168.71.133 is unreachable
192.168.71.134 is unreachable
192.168.71.135 is unreachable
192.168.71.136 is unreachable
192.168.71.137 is unreachable
192.168.71.138 is unreachable
192.168.71.139 is unreachable
192.168.71.140 is unreachable

      11 targets
       2 alive
       9 unreachable
       0 unknown addresses

      36 timeouts (waiting for response)
      38 ICMP Echos sent
       2 ICMP Echo Replies received
      36 other ICMP received

 0.055 ms (min round trip time)
 1.05 ms (avg round trip time)
 2.04 ms (max round trip time)
        4.271 sec (elapsed real time)

执行结果

  1. 共有11个目标地址。
  2. 其中2个是可达的(alive)。
  3. 9个是不可达的(unreachable)。
  4. 0个未知地址。
  5. 共发送了38个ICMP Echo请求,收到了2个ICMP Echo回复。
  6. 共收到36个其他类型的ICMP消息。
  7. 最小往返时间(round trip time)为0.055毫秒。
  8. 平均往返时间为1.05毫秒。
  9. 最大往返时间为2.04毫秒。
  10. 总共花费了4.271秒的实际运行时间。

测试连通整个网络

fping -g -r 1 192.168.71.0/24

创建文件,使用fping测试文件内容的ip地址

[root@localhost ~]# cat 1.sh 
192.168.71.1
192.168.71.12
192.168.71.15
192.168.71.18
192.168.71.10
192.168.71.111
[root@localhost ~]# fping -f 1.sh 
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.12
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.12
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.12
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.12
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.111
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.111
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.111
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.111
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.10
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.10
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.10
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.10
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.18
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.18
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.18
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.18
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.15
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.15
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.15
ICMP Host Unreachable from 192.168.71.130 for ICMP Echo sent to 192.168.71.15
192.168.71.1 is unreachable
192.168.71.12 is unreachable
192.168.71.15 is unreachable
192.168.71.18 is unreachable
192.168.71.10 is unreachable
192.168.71.111 is unreachable

  • 5
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值