fping

fping checks whether the host exists

Supplementary instructions

fping command fping is similar to ping, but more powerful than ping. Unlike ping, which has to wait for a certain host connection to time out or send back feedback information, fping immediately sends a data packet to the next host after sending a data packet to one host to achieve simultaneous pinging of multiple hosts. fping can also specify the requirements on the command line. Number of hosts to ping.

grammar

fping(options)(parameters)

Options

-a # Display live hosts
-b # Ping packet size. (Default is 56)
-c # Number of times to ping each target (default is 1)
-f # Get target list from file (cannot be used with -g)
-l # Send pings in a loop
-g # Generate a target list by specifying the start and end addresses to make the network segment
-u # Show unreachable targets

Example

Install fping command:

# Install epel source first:
yum install epel* -y
#Install fping package:
yum install fping -y

Selective ping specified IP:

~]# fping 192.168.0.1 192.168.0.125 192.168.0.126 2>/dev/null
192.168.0.1 is alive
192.168.0.125 is alive
192.168.0.126 is unreachable

Ping the entire network segment:

~]# fping -g 192.168.0.0/24 2>/dev/null
192.168.0.1 is alive
192.168.0.103 is alive
...
192.168.0.253 is unreachable
192.168.0.254 is unreachable

Ping the entire network segment and only display surviving hosts:

~]# fping -ag 192.168.0.0/24 2>/dev/null
192.168.0.1
192.168.0.103
...

Ping a certain IP:

~]# fping -ag 192.168.0.5 192.168.0.130 2>/dev/null
192.168.0.103
...
192.168.0.125
192.168.0.130