LinuxCommandLibrary

ip-route-show

Show the system's routing table

TLDR

View documentation for the original command

$ tldr ip route list
copy

SYNOPSIS

ip route show [ TABLE ] [ dev DEVICE ] [ to PREFIX ] [ from PREFIX ] [ protocol PROTO ] [ scope SCOPE ] [ type TYPE ] [ tos TOS ]

PARAMETERS

dev DEVICE
    Filter routes by output device

from PREFIX
    Filter by preferred source prefix

to PREFIX
    Filter by destination prefix

tos TOS
    Filter by TOS value

protocol PROTO
    Filter by routing protocol (e.g., static, dhcp)

scope SCOPE
    Filter by route scope (e.g., global, link)

type TYPE
    Filter by route type (e.g., unicast, local, blackhole)

iif DEVICE
    Filter by input interface

oif DEVICE
    Filter by output interface

src PREFIX
    Filter by source prefix

via PREFIX
    Filter by next-hop gateway

mark MARK
    Filter by fwmark

realms REALM
    Filter by routing realms

table TABLE
    Select routing table (e.g., main, local, all)

root PREFIX
    Filter by routes subsuming prefix

match PREFIX
    Filter by routes matching prefix

DESCRIPTION

The ip route show command, part of the iproute2 utilities, queries and displays the Linux kernel's IPv4 and IPv6 routing information database. It lists active routes, including destination prefixes, next-hop gateways, output devices, protocols, scopes, metrics, and preferred sources. By default, it shows entries from the main routing table (ID 254).

Routes are filtered using selectors like dev, to, from, enabling targeted views for troubleshooting connectivity, verifying static/dynamic routes (e.g., from DHCP, BGP, OSPF), or inspecting policy-based routing. Output is compact and parseable, e.g., 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100.

Unlike legacy netstat -r or route -n, it supports multiple tables, multipath routes, VRFs, and realms. Ideal for admins diagnosing routing loops, blackholes, or asymmetric paths. Combine with ip monitor route for real-time changes. Use json or details output formats for scripting.

CAVEATS

Output can be voluminous on routers with large tables; use filters. 'cache' selector deprecated post-kernel 3.6. JSON output requires recent iproute2.

EXAMPLE

ip route show default
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.10

OUTPUT FIELDS

dest via gw dev if proto P scope S metric M src srcip (order varies)

HISTORY

Introduced in iproute2 (1990s) by Alexey Kuznetsov to replace ifconfig/route; evolved with policy routing (2000s), VRFs (2010s), and JSON support (2018+).

SEE ALSO

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

Copied to clipboard