netselect
Select fastest network server from a list
TLDR
Choose the server with the lowest latency
Display nameserver resolution and statistics
Define maximum TTL (time to live)
Print n fastest servers among the hosts
Display help
SYNOPSIS
netselect [options] [hostnames_or_IPs ...]
PARAMETERS
-c count
Specifies the number of ICMP echo requests (pings) to send to each host. Defaults to 5 pings.
-m min_success
Sets the minimum number of successful pings required for a host to be considered viable. Defaults to 2 successful pings.
-o file
Redirects the command's output to the specified file instead of standard output.
-p parallel
Determines the maximum number of hosts to ping simultaneously. Defaults to 16 parallel connections.
-s samples
Number of ping samples to average for ranking. A higher value leads to a more reliable but slower test. Defaults to 3 samples.
-t timeout
Sets the timeout for each individual ping request in seconds. Defaults to 2 seconds.
-v
Enables verbose output, providing more detailed information about the ping process and scores for each host.
-4
Forces netselect to use IPv4 addresses only for host resolution and pinging.
-6
Forces netselect to use IPv6 addresses only for host resolution and pinging.
DESCRIPTION
The netselect command is a utility designed to identify the fastest and most reliable network host from a given list, typically used for choosing optimal mirrors for software repositories.
It operates by sending multiple ICMP echo requests (pings) to each specified host, measuring the round-trip time (latency) and detecting packet loss. Based on these metrics, netselect calculates a 'score' for each host, where a lower score indicates a faster and more reliable connection. The output is a sorted list of hosts, with the best-performing ones appearing at the top.
This tool is particularly useful for users who need to select the best mirror for their Linux distribution's package manager (e.g., Debian's apt or Ubuntu's apt), ensuring quicker and more stable downloads of software packages and updates.
CAVEATS
Results from netselect represent a snapshot in time and can change due to network conditions, server load, or routing changes. It primarily relies on ICMP, so hosts or networks blocking ICMP traffic may yield inaccurate results. For very large lists of hosts, execution can be time-consuming, and simultaneous pinging may cause network congestion or be throttled by firewalls.
OUTPUT FORMAT
The default output of netselect is a sorted list of hosts, each preceded by a numerical 'score'. A lower score indicates better performance. The score is typically calculated based on a weighted average of latency and packet loss. For example:
123 hostname.example.com
456 another.example.net
This allows users to easily pick the top-ranked host for their specific needs, often for updating configuration files related to package mirrors.
HISTORY
netselect is a specialized utility primarily found within the Debian and Ubuntu ecosystems, often bundled as part of core system utilities like 'debianutils'. Its development is driven by the need for users to easily identify the best-performing mirror servers for their package managers, a critical task for maintaining up-to-date and efficient systems. It's not a standalone command with a long, distinct historical lineage like many general-purpose Unix tools, but rather a focused solution for a specific system administration problem.
SEE ALSO
ping(8), traceroute(8), curl(1), wget(1)