Fping – Ubuntu 上用於並行 Ping 主機的命令列工具


Fping 是一個向網路主機發送 ICMP 回顯探測的程式,它類似於 ping,允許使用者檢查遠端主機是否線上。使用 Fping 命令,我們可以同時檢查多個主機。本文介紹了“如何安裝 Fping 命令以及 Fping 命令的用法”。

安裝 Fping 命令

要安裝 Fping 命令,請使用以下命令:

$ sudo apt-get install fping

示例輸出應如下所示:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
   gtk2-engines-pixbuf libbs2b0 libopusfile0 libpyside1.2 libqmmp-misc
   libqmmpui0 libshiboken1.2 libsidplayfp libtidy-0.99-0 linux-headers-4.2.0-27
   linux-headers-4.2.0-27-generic linux-image-4.2.0-27-generic
   linux-image-extra-4.2.0-27-generic linux-signed-image-4.2.0-27-generic
   php7.0-opcache python-beautifulsoup python-feedparser python-html2text
   python-magic python-oauth2 python-pyside.qtcore python-pyside.qtgui
   python-pyside.qtnetwork python-pyside.qtwebkit python-pysqlite2 python-regex
   python-sqlalchemy python-sqlalchemy-ext python-support python-unity-singlet
   python-utidylib
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
   fping
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 30.7 kB of archives.
.........................................................

Fping 命令的用法

要執行 Fping,請使用以下命令:

$ fping tutorialspoint.com

示例輸出應如下所示:

tutorialspoint.com is alive

要測試多個站點,請使用以下命令:

$ fping www.tutorialspoint.com www.google.com

示例輸出應如下所示:

www.tutorialspoint.com is alive
www.google.com is alive

如果主機列表儲存在一個檔案中,請使用以下命令:

$ fping < hosts.txt

示例輸出應如下所示:

www.tutorialspoint.com is alive
www.google.com is alive

要獲取有關fping的更多資訊,請使用以下命令:

$ fping -help

示例輸出應如下所示:

Usage: fping [options] [targets...]
-a    show targets that are alive
-A    show targets by address
-b n  amount of ping data to send, in bytes (default 56)
-B f  set exponential backoff factor to f
-c n  count of pings to send to each target (default 1)
-C n  same as -c, report results in verbose format
-D    print timestamp before each output line
-e    show elapsed time on return packets
-f    file read list of targets from a file ( - means stdin) (only if no -g specified)
-g    generate target list (only if no -f specified)
         (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)
-H n  Set the IP TTL value (Time To Live hops)
-i n  interval between sending ping packets (in millisec) (default 25)
-l    loop sending pings forever
-m    ping multiple interfaces on target host
-n    show targets by name (-d is equivalent)
-p n  interval between ping packets to one target (in millisec)
         (in looping and counting modes, default 1000)
-q    quiet (don't show per-target/per-ping results)
-Q n  same as -q, but show summary every n seconds
-r n  number of retries (default 3)
-s    print final stats
-I    if bind to a particular interface
-S    addr set source address
-t n  individual target initial timeout (in millisec) (default 500)
-T n  ignored (for compatibility with fping 2.4)
-u    show targets that are unreachable
-O n  set the type of service (tos) flag on the ICMP packets
-v    show version
targets list of targets to check (if no -f specified)

恭喜!現在您知道了“如何在 Linux 上安裝和使用 Fping 工具”。我們將在下一篇文章中學習更多關於這類 Linux 命令的內容。繼續關注!

更新於:2020年1月20日

971 次瀏覽

開啟您的職業生涯

完成課程獲得認證

開始學習
廣告
© . All rights reserved.