LinuxCommandLibrary

ip-route-list

List the kernel's routing table

TLDR

Display the main routing table

$ ip [[r|route]] [[l|list]]
copy

Display the main routing table (same as first example)
$ ip [[r|route]] [[l|list]] [[t|table]] [main|254]
copy

Display the local routing table
$ ip [[r|route]] [[l|list]] [[t|table]] [local|255]
copy

Display all routing tables
$ ip [[r|route]] [[l|list]] [[t|table]] [all|unspec|0]
copy

List routes from a given device only
$ ip [[r|route]] [[l|list]] dev [ethX]
copy

List routes within a given scope
$ ip [[r|route]] [[l|list]] [[s|scope]] link
copy

Display the routing cache
$ ip [[r|route]] [[l|list]] [[c|cache]]
copy

Display only IPv6 or IPv4 routes
$ ip [-6|-4] [[r|route]]
copy

SYNOPSIS

ip [GLOBAL-OPTIONS] route list [SELECTOR]

PARAMETERS

dev STRING
    list routes for specified device only

from PREFIX
    list routes with matching source prefix

to PREFIX
    list routes matching destination prefix

tos TOS
    list routes with matching TOS value

via PREFIX
    list routes with matching nexthop prefix

scope SCOPE
    list routes with matching scope (e.g., global)

metric NUMBER
    list routes with matching metric

table TABLE_ID
    list routes from specific table ID or name

label PATTERN
    list routes with matching label pattern

iif STRING
    match inbound interface

oif STRING
    match outbound interface

protocol PROTO
    match routing protocol (e.g., static, bgp)

type TYPE
    match route type (e.g., unicast, local)

DESCRIPTION

The ip route list command, part of the iproute2 utilities, queries and displays the IPv4 routing information from the Linux kernel. It lists active routes including local, direct, static, and dynamic routes learned from protocols like BGP or OSPF.

Without arguments, it shows all routes in the main table. Output includes columns for destination prefix, gateway (nexthop), interface (dev), source IP, metric, protocol, and flags (e.g., U for up, G for gateway).

Selectors filter results by device, prefix, scope, or table, aiding in targeted diagnostics. It's invaluable for troubleshooting connectivity, verifying gateways, and automating network checks via scripts. Unlike legacy netstat -r or route, it supports multipath routes, policy routing tables, and precise selectors.

For IPv6, use ip -6 route list. Always run as root or with CAP_NET_ADMIN for full details.

CAVEATS

IPv4 only; use ip -6 route list for IPv6. Requires CAP_NET_ADMIN or root. Output order not guaranteed.

COMMON EXAMPLES

ip route list (all routes)
ip route list default (default gateways)
ip route list table all (all tables)

OUTPUT COLUMNS

dst (<PREFIX>), via (gateway), dev (interface), scope, src (source IP), proto, metric, flags

HISTORY

Developed by Alexey Kuznetsov in iproute2 (1999+); obsoleted route from net-tools by 2000s for modern routing features like policy routing.

SEE ALSO

ip(8), ip-route(8), ss(8), netstat(8), route(8)

Copied to clipboard