Fping命令批量ping地址

作用:批量的給目標主機發送ping請求,測試主機的存活情況。

fping可以同時ping很多臺機器,

另外一方面是結果易讀,展示出ping多臺主機的結果,fping比ping更加好用。

----官方安裝包下載------------------------------------------------------

   http://www.fping.org/

使用wget直接下載

[root@node1 ~]# wget http://fping.org/dist/fping-4.0.tar.gz
[root@node1 ~]# tar zxf fping-4.0.tar.gz 
[root@node1 ~]# cd fping-4.0

安裝C編譯器,這裏我使用GCC編譯器

[root@node1 fping-4.0]# yum install gcc -y

如果沒有gcc 編譯器會報錯

[root@node1 fping-4.0]# ./configure

在當前目錄下執行make命令

[root@node1 fping-4.0]# make

   使用make install進行編譯安裝fping源碼

[root@www fping-4.0]# make install

測試fping

[root@node1 ~]# fping www.baidu.com
www.baidu.com is alive

 

 

 

fping的命令和參數詳解

Usage: fping [options] [targets...]

用法:fping [選項] [ping的目標]

   -a         show targets that are alive

               顯示可ping通的目標

   -A         show targets by address

               將目標以ip地址的形式顯示

   -b n       amount of ping data to send, in bytes (default 56)

               ping 數據包的大小。(默認爲56)

   -B f       set exponential backoff factor to f

               設置指數反饋因子到f 【這個不懂,求指教~】

   -c n       count of pings to send to each target (default 1)

                ping每個目標的次數 (默認爲1)

   -C n       same as -c, report results in verbose format

                同-c, 返回的結果爲冗長格式

   -e         show elapsed time on return packets

                顯示返回數據包所費時間

   -f file    read list of targets from a file ( - means stdin) (only if no -g specified)

               從文件獲取目標列表( - 表示從標準輸入)(不能與 -g 同時使用)

   -g         generate target list (only if no -f specified)

               生成目標列表(不能與 -f 同時使用)

                (specify the start and end IP in the target list, or supply a IP netmask)

                (ex. fping -g 192.168.1.0 192.168.1.255 or fping -g 192.168.1.0/24)

                (可指定目標的開始和結束IP, 或者提供ip的子網掩碼)

                (例:fping -g 192.168.1.0 192.168.1.255 或 fping -g 192.168.1.0/24)

   -H n       Set the IP TTL value (Time To Live hops)

                設置ip的TTL值 (生存時間)

   -i n       interval between sending ping packets (in millisec) (default 25)

               ping包之間的間隔(單位:毫秒)(默認25)

   -l         loop sending pings forever

              循環發送ping

   -m         ping multiple interfaces on target host

                ping目標主機的多個網口

   -n         show targets by name (-d is equivalent)

                將目標以主機名或域名顯示(等價於 -d )

   -p n       interval between ping packets to one target (in millisec)

                對同一個目標的ping包間隔(毫秒)

                (in looping and counting modes, default 1000)

                (在循環和統計模式中,默認爲1000)

   -q         quiet (don't show per-target/per-ping results)

               安靜模式(不顯示每個目標或每個ping的結果)

   -Q n       same as -q, but show summary every n seconds

               同-q, 但是每n秒顯示信息概要

   -r n       number of retries (default 3)

               當ping失敗時,最大重試次數(默認爲3次)

   -s         print final stats

               打印最後的統計數據

   -I if      bind to a particular interface

              綁定到特定的網卡

   -S addr    set source address

                  設置源ip地址

   -t n       individual target initial timeout (in millisec) (default 500)

               單個目標的超時時間(毫秒)(默認500)

   -T n       ignored (for compatibility with fping 2.4)

                請忽略(爲兼容fping 2.4)

   -u         show targets that are unreachable

                顯示不可到達的目標

   -O n       set the type of service (tos) flag on the ICMP packets

                在icmp包中設置tos(服務類型)

   -v         show version

                顯示版本號

   targets    list of targets to check (if no -f specified)

                需要ping的目標列表(不能和 -f 同時使用)

-h              show this page

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章