ip-tcp_metrics
Display or modify TCP connection metrics
SYNOPSIS
ip [OPTIONS] tcp_metrics { list [ PREFIX ] | flush | delete PREFIX | remember PREFIX [ UID ] }
PARAMETERS
list [PREFIX]
Display current TCP metrics entries optionally filtered by PREFIX (CIDR notation, e.g., 192.168.1.0/24).
flush
Delete all TCP metrics entries from the cache.
delete PREFIX
Remove the TCP metrics entry for the specified PREFIX.
remember PREFIX [UID]
Insert or update TCP metrics entry for PREFIX; optional UID associates with user namespace owner.
DESCRIPTION
The ip tcp_metrics command from the iproute2 suite displays and manipulates the Linux kernel's TCP metrics cache. This cache stores per-destination metrics such as round-trip time (RTT), retransmit timeouts (RTO), and MTU for IPv4/IPv6 addresses, optimizing future TCP connections by avoiding slow start and using proven parameters.
It helps network administrators tune performance for frequently accessed hosts, reducing latency on reconnections. Entries are populated automatically by the kernel during TCP sessions if net.ipv4.tcp_no_metrics_save=0 (default), or manually via this tool.
Useful for servers with persistent client traffic, proxies, or when diagnosing connection issues. Metrics persist across reboots if saved, but are namespace-aware in containerized environments.
CAVEATS
Metrics are host-specific and separate for IPv4/IPv6; use -4 or -6 for family. Entries auto-expire if unused. Requires root privileges. In network namespaces, affects only current namespace.
EXAMPLES
ip tcp_metrics list # View all
ip tcp_metrics delete 10.0.0.1/32 # Clear specific host
ip -6 tcp_metrics list # IPv6 only
KERNEL SYSCTLS
Related tunables: net.ipv4.tcp_no_metrics_save=0 (enable saving), net.ipv4.tcp_mtu_probing=1 (PMTU discovery).
HISTORY
Introduced in iproute2 around 2008 (kernel 2.6.13+ support for TCP metrics via /proc/net/tcp_metrics; enhanced in 3.x kernels with namespaces). Widely used since Linux 4.x for container optimization.


