fping命令的官网为:http://fping.org/
历史版本下载地址:http://fping.org/dist/
第一步:安装。
wget http://fping.org/dist/fping-5.0.tar.gz
tar -xzvf fping-5.0.tar.gz
cd fping-5.0
./configure --prefix=/usr/local/fping #指定安装路径
make
make install
安装完成
配置一下环境变量
> vim /etc/profile
export PATH=$PATH:/usr/local/fping/sbin
> source /etc/profile
> fping -v #测试下是否成功
安装成功之后输入fping -h查看帮助文档。
第二步:使用分享
fping -g ip1 ip2
-g是ping某个pi段之间是否可达,比如fping -g 100.101.10.100 100.101.10.200
如下图:
也可以通过掩码来写:如fping -g 100.101.10.1/24
有时候也可以再加一个参数-a 即 如fping -a -g 100.101.10.1/24 这样可以直接显示可达的
常用: fping -Asg 192.168.1.0/24 #以IP显示是否在线,并打印出报告
Usage(用法): fping [选项] [目标...]
-a 显示目标地址是否在线
-A 以IP地址显示,并判断是否在线
-b n 发送ping的数据包量,以字节为单位 (默认 56),n写成数量,以下参数同此
-B f 设置指数回退因素为f
-c n 计算要发送到每个目标的ping信号 (默认发送 1 个包)
-C n 功能同-c,报告结果更详细
-D 在每个输出行打印时间戳
-e 显示返回包的运行时间
-f file 从文件中读取目标列表 ( - means stdin) (only if no -g specified)
-g 生成目标列表 (only if no -f specified)
(在目标列表中指定开始和结束IP, 或者提供一个IP网络掩码)
(ex. fping -g 192.168.1.0 192.168.1.255 or fping -g 192.168.1.0/24)
-H n 设置IP TTL值(Time To Live hops)
-i n 发送ping包之间的间隔 (in millisec毫秒) (default 25)
-I 如果绑定到特定接口
-l loop sending pings forever永不
-m ping目标主机上的多个接口
-M 设置Don't Fragment标志
-n 按名称显示目标 (-d is equivalent等效的)
-N 为网络数据输出兼容(-l -Q are required必须的)
-o 显示累计停机时间 (lost packets * packet interval 间隔)
-O n 在ICMP包上设置服务类型(tos)标志
-p n ping包到一个目标之间的间隔 (in millisec)
(in looping and counting modes, default 1000)
-q 安静模式 (don't show per-target/per-ping results)
-Q n 功能如同 -q, 每n秒显示摘要
-r n 重复次数 (default 3)
-R 随机分组数据 (to foil阻止 link data compression压缩)
-s 打印最后的统计数据
-S 设置源地址
-t n 单个目标初始超时 (in millisec) (default 500)
-T n 忽略(for compatibility兼容性 with fping 2.4)
-u 显示目标不可达
-v 显示版本
要检查的目标列表 (if no -f specified)
fping 5.0
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 addre ss)
(ex. fping -g 192.168.1.0 192.168.1.255 or fping -g 192.16 8.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), us e 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 in terval)
-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
"
Copyright © 2002-2022 http://www.aksky.com |
备案号:浙ICP备17002154号-2 Powered by: myarticle.com.cn Version 1.0dev
|