LinuxCommandLibrary

fping

Ping multiple hosts simultaneously

TLDR

List the status of all hosts within a range

$ fping [192.168.1.{1..254]}
copy

List alive hosts within a subnet generated from a netmask
$ fping [[-a|--alive]] [[-g|--generate]] [192.168.1.0/24]
copy

List alive hosts within a subnet generated from an IP range and prune per-probe results
$ fping [[-q|--quiet]] [[-a|--alive]] [[-g|--generate]] [192.168.1.1] [192.168.1.254]
copy

List unreachable hosts within a subnet generated from a netmask
$ fping [[-u|--unreach]] [[-g|--generate]] [192.168.1.0/24]
copy

SYNOPSIS

fping [options] [target_hosts...]
fping [options] -f file_with_hosts
fping [options] -g start_ip end_ip | CIDR_notation

PARAMETERS

-a
    Show only systems that are alive and reachable.

-A
    Display target IP addresses instead of hostnames in the output.

-b <length>
    Set the size of the ping data payload in bytes (default: 56).

-c <count>
    Number of ICMP echo requests to send to each target (default: 1).

-f
    Read list of target hosts from a specified file instead of command line arguments.

-g
    Generate target IP addresses from a given start/end IP range or CIDR block (e.g., 192.168.1.0/24).

-i <interval>
    Set the minimum interval (in milliseconds) between sending packets to any target (default: 10ms).

-l
    Loop indefinitely, continuously pinging targets until interrupted.

-n
    Display IP addresses instead of hostnames in the output. This can speed up execution by avoiding DNS lookups.

-q
    Quiet mode; suppress output for hosts that respond. Only unresponding hosts are displayed.

-r <retries>
    Number of times to retry sending a packet to a target if no reply is received (default: 3).

-s
    Display summary statistics at the end of execution, including count of alive/unreachable hosts.

-t <timeout>
    Set the initial timeout (in milliseconds) for a host reply. If no reply is received within this time, the host is considered unreachable (default: 500ms).

-u
    Show only systems that are unreachable.

-v
    Provide verbose output, showing more details about the ping process and results.

DESCRIPTION

fping is a powerful command-line utility designed for rapidly sending ICMP echo requests (pings) to multiple network hosts. Unlike the traditional ping command, which typically processes one host at a time, fping operates in a highly efficient, parallel, and round-robin fashion. This allows it to check the reachability of a large number of hosts much faster by sending packets to the next host as soon as a reply is received or a timeout occurs for the current host.

It's widely used by network administrators for quick network scanning, host discovery, and monitoring host availability. fping supports various output formats, including summarized statistics, and can read target host lists from standard input or a file, making it highly scriptable for automated network checks. Its capabilities make it an invaluable tool for maintaining and troubleshooting network infrastructure.

CAVEATS

fping requires root privileges or the CAP_NET_RAW capability to create raw ICMP sockets. Improper use on large network ranges can generate significant network traffic. DNS lookups (when not using -n) can slow down the process considerably.

EXIT STATUS

fping provides meaningful exit codes for scripting and automation:
0: All target hosts are alive.
1: Some target hosts are alive, while others are unreachable.
2: All target hosts are unreachable.
3: A fatal error occurred (e.g., incorrect usage, permission issues).

PERMISSIONS

Due to its use of raw sockets for ICMP, fping typically needs root privileges or the CAP_NET_RAW Linux capability. This capability can be set with: sudo setcap cap_net_raw+ep /usr/sbin/fping (note: the path to fping may vary on different systems).

HISTORY

fping was initially written by Roland Schemers in 1992 as a faster alternative to the standard ping utility for scanning multiple hosts. It introduced the concept of sending multiple pings in a round-robin fashion, significantly improving efficiency for network discovery and monitoring tasks. Over the years, it has been maintained and improved by various contributors, solidifying its role as a fundamental tool for network administrators.

SEE ALSO

ping(8), nmap(1), arp(8), netstat(8), mtr(8)

Copied to clipboard