LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ip-route-list

displays entries from the kernel routing tables

TLDR

Display the main routing table
$ ip route list
copy
Display the local routing table
$ ip route list table local
copy
Display all routing tables
$ ip route list table all
copy
List routes for a specific device
$ ip route list dev [eth0]
copy
List routes within a specific scope
$ ip route list scope link
copy
List routes via a specific gateway
$ ip route list via [192.168.1.1]
copy
List routes added by a specific protocol (e.g. DHCP, static)
$ ip route list proto [dhcp|static|kernel]
copy
Show exact route for a prefix, or all routes matching an address
$ ip route list [exact|match] [10.0.0.0/8]
copy
Display IPv6 cached (exception) routes, e.g. PMTU entries
$ ip -6 route list cached
copy
Display only IPv6 routes
$ ip -6 route
copy
Display only IPv4 routes
$ ip -4 route
copy

SYNOPSIS

ip route { list | show } [[to] [root | match | exact] PREFIX] [table TABLE] [vrf NAME] [proto RTPROTO] [type TYPE] [scope SCOPE] [dev DEV] [via PREFIX] [src PREFIX]

DESCRIPTION

ip route list displays entries from the kernel routing tables. The main table contains user-configured routes, while the local table contains routes for local addresses automatically maintained by the kernel.Without a command, ip route defaults to list; show is a synonym. Routes show the destination network, gateway or interface, and various attributes like metrics, source preference, and protocol that added the route.

PARAMETERS

to [root | match | exact] PREFIX

Select destinations: root lists prefixes not shorter than PREFIX, match those not longer than PREFIX (covering routes), exact (default) only that prefix. Without a prefix, the whole table is listed
table TABLE
Routing table: main (254), local (255), all (0), or custom name/number
dev DEVICE
Show routes for specific device only
scope SCOPE
Filter by scope: global, link, host
vrf NAME
Show routes of the table bound to a VRF
cached, cloned
Show cloned/cached routes (equivalent to table cache)
via PREFIX
Only routes whose next hop matches PREFIX
src PREFIX
Only routes with a preferred source address in PREFIX
type TYPE
Route type: unicast, local, broadcast, multicast, etc.
proto PROTOCOL
Filter by routing protocol: kernel, boot, static, dhcp, ra, bgp, etc.

INSTALL

sudo apt install iproute2
copy
sudo pacman -S iproute2
copy
sudo apk add iproute2-minimal
copy
sudo zypper install iproute2
copy
brew install iproute2
copy
nix profile install nixpkgs#iproute2
copy

CAVEATS

The IPv4 routing cache was removed in Linux 3.6, so cached only shows IPv6 exception routes on modern kernels. Very large routing tables may produce extensive output. Multiple tables exist for policy routing setups.

HISTORY

ip route list is part of iproute2 and replaces the older route command. It provides comprehensive access to Linux's advanced routing features including multiple tables and policy routing.

SEE ALSO

ip(8), ip-route(8), ip-route-add(8), ip-rule(8)

RESOURCES

Copied to clipboard
Kai