LinuxCommandLibrary

ip-route-list

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
Display the routing cache
$ ip route list cache
copy
Display only IPv6 routes
$ ip -6 route
copy
Display only IPv4 routes
$ ip -4 route
copy

SYNOPSIS

ip route list [selector]

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.
Routes show the destination network, gateway or interface, and various attributes like metrics, source preference, and protocol that added the route.

PARAMETERS

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
cache
Show routing cache entries
type TYPE
Route type: unicast, local, broadcast, multicast, etc.
proto PROTOCOL
Filter by routing protocol

CAVEATS

The routing cache was removed in Linux 3.6. 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)

Copied to clipboard