fping: High-performance ping sweep tool

fping High-performance ping sweep tool

1. Tool Introduction

fping is a scriptable, high-performance variant of the standard ping utility, designed specifically to test the reachability of a large number of hosts efficiently. Unlike traditional ping, which sends a request and waits for a reply before moving to the next target, fping sends ICMP Echo Requests to multiple hosts in a round-robin fashion, cycling through the target list, which allows it to test many hosts in parallel rather than sequentially. This makes it especially well-suited for scanning entire subnets or large host lists as part of network discovery, monitoring, and inventory scripts. fping is included in the Kali Linux repositories.

2. Installation

sudo apt update
sudo apt install fping -y

Verify:

fping -v

Expected output:

fping: Version 5.1

3. Syntax

fping [OPTIONS] [target ...]

4. Command-Line Options (Full Reference)

5. Basic Usage

fping -a -g 192.168.1.0/24

Expected output:

192.168.1.1 is alive
192.168.1.10 is alive
192.168.1.15 is alive

6. Practical Examples

Example 1 — Ping sweep a CIDR range, only show alive hosts

fping -a -g 10.10.10.0/24 2>/dev/null
10.10.10.1 is alive
10.10.10.5 is alive

Example 2 — Ping sweep an explicit IP range

fping -a -g 192.168.1.1 192.168.1.50 2>/dev/null
192.168.1.1 is alive
192.168.1.10 is alive

Example 3 — Read targets from a file

fping -a -f hosts.txt
10.10.10.5 is alive
10.10.10.9 is alive

Example 4 — Show elapsed round-trip time

fping -e -c 3 192.168.1.10
192.168.1.10 : [0], 84 bytes, 0.51 ms (0.51 avg, 0% loss)
192.168.1.10 : [1], 84 bytes, 0.49 ms (0.50 avg, 0% loss)
192.168.1.10 : [2], 84 bytes, 0.53 ms (0.51 avg, 0% loss)

Example 5 — Show only unreachable hosts

fping -u -g 192.168.1.0/24 2>/dev/null
192.168.1.99 is unreachable
192.168.1.200 is unreachable

Example 6 — Quiet mode with periodic summary

fping -q -Q 5 -g 192.168.1.0/24
[5.0]     256 targets, 240 alive, 16 unreachable, 100% packets alive

Example 7 — Print cumulative statistics table

fping -s -c 3 -g 10.10.10.0/28
10.10.10.1 : xmt/rcv/%loss = 3/3/0%, min/avg/max = 0.42/0.45/0.51
     Sent:16   Rcvd:14   Loss: 12%

Example 8 — Formatted parsable per-target report

fping -C 3 -q 192.168.1.1 192.168.1.10
192.168.1.1  : 0.51 0.49 0.53
192.168.1.10 : 0.61 0.58 0.60

Example 9 — Set custom timeout and retries for a lossy network

fping -t 500 -r 5 -a -g 192.168.1.0/24
192.168.1.1 is alive
192.168.1.15 is alive

Example 10 — Timestamped continuous loop mode (stopped with Ctrl+C)

fping -D -l 192.168.1.10
[1752912345] 192.168.1.10 : [0], 84 bytes, 0.51 ms
[1752912346] 192.168.1.10 : [1], 84 bytes, 0.49 ms

7. Common Use Cases

8. Automation with Bash

#!/bin/bash
# fping_sweep.sh - fast subnet sweep feeding into Nmap
SUBNET="192.168.1.0/24"
ALIVE="alive_hosts.txt"

echo "[*] Running fping sweep on $SUBNET..."
fping -a -g "$SUBNET" 2>/dev/null > "$ALIVE"

echo "[*] Found $(wc -l < "$ALIVE") live hosts. Starting Nmap follow-up..."
while read -r host; do
    nmap -sC -sV "$host" -oN "nmap_${host}.txt"
done < "$ALIVE"

9. Tips and Best Practices

10. Troubleshooting

11. References

Exit mobile version