route
Display and manage IP routing table
TLDR
Display the routing table
SYNOPSIS
route [-n] [-v] [add|del] [-net|-host] target [gw gateway] [netmask mask] [dev interface]
DESCRIPTION
route displays and manipulates the IP routing table. The kernel uses routing tables to determine where to send network packets based on their destination addresses.
Without arguments, route displays the current routing table. The -n flag shows numeric addresses, avoiding DNS lookups and speeding up display.
Routes can be added for networks (ranges of addresses) or specific hosts. The default route (0.0.0.0/0) handles traffic that doesn't match any specific route—typically pointing to the internet gateway.
Modern Linux systems prefer ip route from iproute2, but route remains available for compatibility and familiarity.
PARAMETERS
-n
Show numeric addresses (don't resolve hostnames)-v
Verbose outputadd
Add a new routedel
Delete a route-net
Target is a network-host
Target is a hostgw gateway
Route packets via specified gatewaynetmask mask
Specify netmask for network routedev interface
Force route to use specified interfacemetric M
Set metric (priority) for the routereject
Install a blocking route
OUTPUT COLUMNS
Destination: Target network or host
Gateway: Gateway address (\* means none needed)
Genmask: Netmask for the destination
Flags: U=up, G=gateway, H=host, !=reject
Metric: Route priority (lower = preferred)
Iface: Outgoing interface
CAVEATS
Route changes made with route are not persistent across reboots. Use network configuration files or NetworkManager for permanent routes.
The route command is deprecated in favor of ip route from the iproute2 package, which offers more features and consistent syntax.
Modifying routes requires root privileges. Incorrect routing can cause network connectivity loss.
SEE ALSO
ip(8), netstat(8), iptables(8), traceroute(8)
