fping

更为强大的ping

CentOS 中由EPEL源提供
官网:http://www.fping.org/

[21:25:38 rooter@C8-3-55 ~]#type fping
fping 是 /usr/sbin/fping
[21:26:13 rooter@C8-3-55 ~]#whatis fping
fping (8)            - send ICMP ECHO_REQUEST packets to network hosts
[21:26:21 rooter@C8-3-55 ~]#rpm -qi fping
Name        : fping
Version     : 4.2
Release     : 2.el8
Architecture: x86_64
Install Date: 2021年04月19日 星期一 12时29分11秒
Group       : Unspecified
Size        : 64875
License     : BSD with advertising
Signature   : RSA/SHA256, 2019年08月28日 星期三 10时41分52秒, Key ID 21ea45ab2f86d6a1
Source RPM  : fping-4.2-2.el8.src.rpm
Build Date  : 2019年08月19日 星期一 11时22分52秒
Build Host  : buildvm-09.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://www.fping.org/
Bug URL     : https://bugz.fedoraproject.org/fping
Summary     : Scriptable, parallelized ping-like utility
Description :
fping is a ping-like program which can determine the accessibility of
multiple hosts using ICMP echo requests. fping is designed for parallelized
monitoring of large numbers of systems, and is developed with ease of
use in scripting in mind.

fping可以直观的显示网络ip的状态

[21:26:32 rooter@C8-3-55 ~]#fping 10.0.0.56
10.0.0.56 is alive
[21:27:18 rooter@C8-3-55 ~]#fping www.baidu.com
www.baidu.com is alive
[21:27:32 rooter@C8-3-55 ~]#fping www.google.com
www.google.com is unreachable
[21:27:51 rooter@C8-3-55 ~]#echo $?
1

并且可以用echo $?查看返回值,
在写脚本时,可以直接用来判断网络健康情况

fping可以一次ping多个地址

[21:29:18 rooter@C8-3-55 ~]#fping 10.0.0.1 10.0.0.100
10.0.0.1 is unreachable
10.0.0.100 is unreachable

fping加参数g实现ping网络区间

fping -g 起始地址 终止地址

实例:

[21:31:12 rooter@C8-3-55 ~]#fping -g 10.0.0.50 10.0.0.60
10.0.0.55 is alive
10.0.0.56 is alive
10.0.0.58 is alive
ICMP Host Unreachable from 10.0.0.55 for ICMP Echo sent to 10.0.0.57
10.0.0.50 is unreachable
10.0.0.51 is unreachable
10.0.0.52 is unreachable
10.0.0.53 is unreachable
10.0.0.54 is unreachable
10.0.0.57 is unreachable
10.0.0.59 is unreachable
10.0.0.60 is unreachable

fping实现ping整个网段

fping -g 网络ID/网络位 (俗称的CIDR地址表示方式)
10.0.0.2 is alive
10.0.0.55 is alive
10.0.0.56 is alive
10.0.0.58 is alive
^C10.0.0.1 is unreachable
10.0.0.3 is unreachable
10.0.0.4 is unreachable
10.0.0.5 is unreachable

这都省了写循环了,直接给你ping出来了

for i in {1..254};do ping -c -W1 192.168.88.$i && echo "192.168.88.$i" is alive || echo "192.168.88.$i" is down;
done

支持标准输入输出重定向

可以将地址写进文件,并通过文件重定向给fping执行群扫

fping < host.txt

可以将扫描的结果保存到文件

fping -g 172.20.0.0/16 &> fping`date +%F`.log

禁止主机被ping

网络通畅的主机却不能被ping通,可能由于修改了配置文件

echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all

实例

  • 10.0.0.56 当前状态为可以ping通状态
[root@C6-56 ~]# cat /proc/sys/net/ipv4/icmp_echo_ignore_
icmp_echo_ignore_all         icmp_echo_ignore_broadcasts
[root@C6-56 ~]# cat /proc/sys/net/ipv4/icmp_echo_ignore_all
0
[root@C6-56 ~]# ping 10.0.0.56
PING 10.0.0.56 (10.0.0.56) 56(84) bytes of data.
64 bytes from 10.0.0.56: icmp_seq=1 ttl=64 time=0.014 ms
64 bytes from 10.0.0.56: icmp_seq=2 ttl=64 time=0.041 ms
64 bytes from 10.0.0.56: icmp_seq=3 ttl=64 time=0.029 ms
64 bytes from 10.0.0.56: icmp_seq=4 ttl=64 time=0.023 ms
^C
--- 10.0.0.56 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3600ms
rtt min/avg/max/mdev = 0.014/0.026/0.041/0.011 ms
  • 通过更改文件中的值,将10.0.0.56禁止主机被ping
[root@C6-56 ~]# echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
[root@C6-56 ~]# cat /proc/sys/net/ipv4/icmp_echo_ignore_all
1
[root@C6-56 ~]# ping 10.0.0.56
PING 10.0.0.56 (10.0.0.56) 56(84) bytes of data.
^C
--- 10.0.0.56 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4501ms

ping通常用于嗅探网络中服务器的第一步,也可使用次方法在网络中隐藏服务器,从而减少攻击

fping的更多内容

[22:28:54 rooter@C8-3-55 ~]#fping --help
Usage: fping [options] [targets...]Probing options:-4, --ipv4         only ping IPv4 addresses-6, --ipv6         only ping IPv6 addresses-b, --size=BYTES   amount of ping data to send, in bytes (default: 56)-B, --backoff=N    set exponential backoff factor to N (default: 1.5)-c, --count=N      count mode: send N pings to each target-f, --file=FILE    read list of targets from a file ( - means stdin)-g, --generate     generate target list (only if no -f specified)(give start and end IP in the target list, or a CIDR address)(ex. fping -g 192.168.1.0 192.168.1.255 or fping -g 192.168.1.0/24)-H, --ttl=N        set the IP TTL value (Time To Live hops)-I, --iface=IFACE  bind to a particular interface-l, --loop         loop mode: send pings forever-m, --all          use all IPs of provided hostnames (e.g. IPv4 and IPv6), use with -A-M, --dontfrag     set the Don't Fragment flag-O, --tos=N        set the type of service (tos) flag on the ICMP packets-p, --period=MSEC  interval between ping packets to one target (in ms)(in loop and count modes, default: 1000 ms)-r, --retry=N      number of retries (default: 3)-R, --random       random packet data (to foil link data compression)-S, --src=IP       set source address-t, --timeout=MSEC individual target initial timeout (default: 500 ms,except with -l/-c/-C, where it's the -p period up to 2000 ms)Output options:-a, --alive        show targets that are alive-A, --addr         show targets by address-C, --vcount=N     same as -c, report results in verbose format-D, --timestamp    print timestamp before each output line-e, --elapsed      show elapsed time on return packets-i, --interval=MSEC  interval between sending ping packets (default: 10 ms)-n, --name         show targets by name (-d is equivalent)-N, --netdata      output compatible for netdata (-l -Q are required)-o, --outage       show the accumulated outage time (lost packets * packet interval)-q, --quiet        quiet (don't show per-target/per-ping results)-Q, --squiet=SECS  same as -q, but show summary every n seconds-s, --stats        print final stats-u, --unreach      show targets that are unreachable-v, --version      show version-x, --reachable=N  shows if >=N hosts are reachable or not

Linux网络工具之fping相关推荐

  1. linux时间戳_10款优秀的 Linux 网络工具

    作者:LinuxAndUbuntu 链接:linux.cn/article-9153-1.html iftop iftop network monitoring tool Linux 用户通常都熟悉 ...

  2. 推荐一波 Linux 网络工具

    关注+星标公众号,不错过精彩内容 来源 | 一口Linux 如果要在你的系统上监控网络,那么使用命令行工具是非常实用的,并且对于 Linux 用户来说,有着许许多多现成的工具可以使用,如:nethog ...

  3. 那些年,用过的Linux网络工具

    Linux作为一款强大的操作系统,凭借其优异的的网络服务功能,被广泛使用到云服务中心.数据中心.嵌入式边缘物联代理等需要可靠的网络服务支持的场景中.具体到生成环境,免不了使用工具去管理和控制网络,本文 ...

  4. Linux 网络工具——nc命令

    功能说明:强大的网络工具 语 法:nc [-hlnruz][-g<网关...>][-G<指向器数目>][-i<延迟秒数>][-o<输出文件>][-p&l ...

  5. linux ip命令 flush,Linux网络工具学习之:IP命令学习03

    8种机械键盘轴体对比 本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选? 标签(空格分隔): 网络本文旨在通过IP命令介绍和学习Linux网络的相关知识 1. 概述 2. ip link 3. ...

  6. linux php使用fping,Linux常用网络工具:fping主机扫描

    Linux下有很多强大网络扫描工具,网络扫描工具可以分为:主机扫描.主机服务扫描.路由扫描等. fping是一个主机扫描工具,相比于ping工具可以批量扫描主机. fping官方网站:http://f ...

  7. linux网络工具iproute2的使用简介 ip addr

    一.写本文的目的 本文完全是自己在学习iproute2的过程中搜集的大杂烩,记录在这里,方便以后自己查询学习,图片都是来自网络,在此表示感谢! 二.简单了解iproute2工具套装 iproute2是 ...

  8. Linux 上功能强大的网络工具 tcpdump 详解

    tcpdump 是用于捕获传入和传出流量的网络实用程序.这是您需要了解的有关在 Linux 上使用 tcpdump 的所有信息. Linux 配备了大量的网络实用程序可供选择.tcpdump 是一种功 ...

  9. Linux 网络分析工具 fping命令解析

    目录 官网 简介 如何在Linux系统中安装Fping 命令示例. 1. Fping多个IP地址 2. Fping IP地址范围 3.使用不同选项填充完整网络 4.从文件中读取目标列表 5.显示Fpi ...

最新文章

  1. Pytorch的网络结构可视化(tensorboardX)(详细)
  2. 移动互联网时代之用户名和密码何去何从(1)
  3. C# 中DateTime的各种使用
  4. iOS开发UI篇—Quartz2D使用(绘制基本图形)
  5. Mysql 乱码的解决
  6. 学习Python3:201701030
  7. 架构师不可不知的十大可扩展架构
  8. 杭电 1233 最小生成树 kruskal()算法
  9. mysql支持cube_mysql聚合函数rollup和cube
  10. Net学习日记_ASP.Net_MVC_新语法笔记
  11. Kali Linux 破解无线网密码
  12. 国内多少所高校开始博士生采用申请招生的方法了?
  13. 计算机网络本直通线的制作方法,计算机网络技术实训报告模版--交叉线与直通线制作.doc...
  14. Springboot实战项目完结篇之商城系统之收货地址管理
  15. 如何解决audiodg占用内存高(停止与重启audiodg服务)
  16. Windows 11系统还原点怎么创建?
  17. 如何展示实时音视频通话时正在说话用户的音浪
  18. nacos中startup 启动报错
  19. MySQL DELETE 操作后没有释放磁盘空间
  20. Rocket核心流程源码分析

热门文章

  1. 微型微通道输送系统店 学生兼职业务的实施方案
  2. 如何选择适合自己的域名?怎么选择域名?
  3. c语言 printf 输出格式控制 %#x 带0x 16进制的输出
  4. 推荐一款国内前端响应式框架Pintuer
  5. 【全集】大数据Java基础
  6. iPhone手机变卡怎么办?五个解决方法你需要知道
  7. 2019辽师计算机考研分数线,2020辽宁师范大学研究生分数线一览表(含2018-2019历年复试分数线)...
  8. 京东健康、平安健康To B各有倚仗
  9. switch(String)语法糖解析
  10. aop注解配置切点 spring_使用注解匹配Spring Aop切点表达式