iproute2

On this page 7

iproute2 is the standard collection of user-space utilities for configuring networking in Linux, covering interfaces, addresses, routing, neighbor tables, tunnels, network namespaces and traffic control. It talks to the kernel through Netlink sockets and has replaced the older net-tools package, whose commands such as ifconfig, route and netstat are now considered legacy.

In Linux networking, iproute2 is the low-level layer that almost every higher-level tool builds on or mirrors. NetworkManager, systemd-networkd and Netplan write persistent configuration, but administrators use iproute2 to inspect the live kernel state and to make immediate, temporary changes.

How iproute2 communicates with the kernel

iproute2 sends structured requests over rtnetlink, the routing family of the Netlink protocol, instead of using the older ioctl calls that net-tools relied on. Netlink messages carry typed attributes, so new kernel features such as VRF devices, multipath routes or VXLAN options can be exposed without redesigning the interface.

Because the kernel is the single source of truth, iproute2 shows exactly what the network stack is doing at that moment. Every change it makes is applied immediately but not persistent: a reboot or a restart of the network manager discards it unless the same settings are stored in a configuration system.

Netlink also supports event subscriptions. The ip monitor mode listens for kernel notifications and prints link, address and route changes as they happen, which is valuable when diagnosing flapping interfaces or routing daemons.

Utilities included in iproute2

The package contains several specialized programs, each responsible for one area of the network stack. The table below lists the most frequently used ones.

UtilityPurposeTypical use
ipInterfaces, addresses, routes, rules, namespacesAssigning an address or adding a route
ssSocket statisticsListing listening ports and TCP connection states
tcTraffic control and queuing disciplinesShaping bandwidth or adding latency
bridgeLinux bridge ports, VLANs and forwarding databaseInspecting learned MAC addresses
devlinkDevice-level settings for network hardwareConfiguring SmartNIC or switch ASIC options
nstatKernel network countersTracking retransmissions and drops
Main iproute2 utilities and their purpose

The ip utility is organized into objects and actions. Objects include link, address, route, rule, neigh, netns, tunnel and xfrm; actions include show, add, del, set and flush. Commands accept unique prefixes, so ip a is equivalent to ip address show.

Recent versions add machine-readable output. The -j option produces JSON, the -br option prints a compact one-line summary per interface, and -c adds color. JSON output makes iproute2 a reliable data source for scripts and monitoring agents.

iproute2 compared with net-tools

iproute2 is the maintained successor to net-tools, and most current distributions no longer install net-tools by default. The older commands still work on many systems, but they cannot display or configure several modern kernel features.

TaskLegacy net-tools commandiproute2 command
Show interfaces and addressesifconfigip address show
Show routing tableroute -nip route show
Show ARP or neighbor tablearp -nip neigh show
List open socketsnetstat -tulpnss -tulpn
Manage bridgesbrctlip link and bridge
Multicast membershipsnetstat -gip maddress show
Legacy net-tools commands and their iproute2 equivalents

The practical differences are significant. ifconfig shows only one address per interface label and hides secondary addresses added with iproute2, while ip address lists every IPv4 and IPv6 address. net-tools also has no support for policy routing tables, network namespaces or most tunnel types.

Advanced capabilities of iproute2

Beyond basic addressing, iproute2 exposes the full feature set of the Linux network stack, which is why container runtimes, VPN software and routers depend on it.

  • Policy-based routing: ip rule selects one of up to 2^32 routing tables by source address, firewall mark or interface; named tables live in the rt_tables file under the iproute2 configuration directory.
  • Network namespaces: ip netns creates isolated network stacks, the same mechanism containers use.
  • Virtual devices: ip link add creates veth pairs, VLAN, VXLAN, bond, bridge, macvlan, WireGuard and VRF interfaces.
  • IPsec state: ip xfrm manages security associations and policies in the kernel.
  • Equal-cost multipath: a single route can list several next hops with weights.

The next table shows which iproute2 object handles common advanced tasks.

TaskObjectExample
Route traffic from one subnet via a second uplinkip rule and ip routeip rule add from 10.2.0.0/24 table 200
Connect a namespace to the hostip link with vethip link add veth0 type veth peer name veth1
Tag traffic with VLAN 30ip link with vlanip link add link eth0 name eth0.30 type vlan id 30
Add 50 ms of delay for testingtc qdisctc qdisc add dev eth0 root netem delay 50ms
Watch routing changes liveip monitorip monitor route
Advanced tasks and the responsible iproute2 object

Common mistakes and limitations of iproute2

The most common mistake is treating iproute2 changes as permanent. An address added with ip address add disappears after a reboot, and NetworkManager or systemd-networkd may remove it even sooner when they reapply their own configuration.

  • Conflicting managers: manual changes on an interface controlled by NetworkManager can be silently overwritten.
  • Missing prefix length: omitting /24 assigns a /32 host address and breaks the connected route.
  • Flushing the wrong object: ip address flush dev eth0 over SSH can cut off the remote session.
  • Assuming the main table: with policy routing, ip route show displays only the main table; ip route show table all reveals the rest.

iproute2 is also not a configuration management system. It has no file format for complete interface definitions and does not handle DHCP, Wi-Fi authentication or DNS; those tasks belong to tools such as NetworkManager, wpa_supplicant and systemd-resolved.

In simple terms

iproute2 is the toolbox Linux administrators use to see and change network settings directly in the system core. With it, they can check which addresses a computer has, which path its traffic takes and which connections are open.

Think of it as the control panel behind the scenes. Friendly network settings windows save preferences and restore them after each restart, but iproute2 changes what is happening right now. That makes it ideal for troubleshooting, while permanent settings belong elsewhere.

A practical example

A hosting provider runs a Linux server with two uplinks: a primary link on 203.0.113.0/24 and a backup link on 198.51.100.0/24. Replies to clients who reach the backup address were leaving through the primary link, so upstream filters dropped them as spoofed traffic.

The engineer creates a second routing table named backup with ID 200, adds a default route through the backup gateway with ip route add default via 198.51.100.1 table backup, and adds ip rule add from 198.51.100.10 table backup. Running ss -tn and ip route get 192.0.2.50 from 198.51.100.10 confirms the path. After testing, the same rules are written into the systemd-networkd configuration for persistence. The result is symmetric routing on both uplinks and no more dropped replies.