LinuxCommandLibrary

ifmetric

manipulates IPv4 route metrics for network interfaces

TLDR

Set the priority of a network interface (higher number = lower priority)

$ sudo ifmetric [interface] [value]
copy
Reset the priority of an interface to default
$ sudo ifmetric [interface] 0
copy

SYNOPSIS

ifmetric interface metric

DESCRIPTION

ifmetric manipulates IPv4 route metrics for network interfaces. Route metrics determine which interface is preferred when multiple routes to the same destination exist - lower metric values have higher priority.
This is useful for systems with multiple network connections (e.g., wired and wireless) where you want to control which connection is preferred for outgoing traffic.

PARAMETERS

interface

Name of the network interface (e.g., eth0, wlan0)
metric
Route metric value (higher values mean lower priority, 0 resets to default)

CAVEATS

Requires root privileges. Only affects IPv4 routes. Changes are not persistent across reboots unless scripted. Does not work with IPv6 routes.

HISTORY

ifmetric was created by Lennart Poettering (who later created PulseAudio and systemd) to provide a simple way to manipulate routing metrics without complex ip route commands.

SEE ALSO

ip(8), route(8), ifup(8)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community