route
Display and manage IP routing table
TLDR
SYNOPSIS
route [-CFvnNee] [-A family|-4|-6]route [-v] [-A family|-4|-6] add|del [-net|-host] target [netmask mask] [gw gateway] [metric N] [mss M] [window W] [irtt I] [reject] [dev interface]route [-V|--version] [-h|--help]
DESCRIPTION
route displays and manipulates the kernel 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 for IPv4) handles traffic that doesn't match any more specific route—typically pointing to the internet gateway.The gateway specified with gw must be directly reachable via an existing route before a new route through it can be added. CIDR prefix notation (e.g., 10.0.0.0/8) is supported for the target, and is equivalent to specifying a target with a netmask.Modern Linux systems prefer ip route from the iproute2 package, but route remains available for compatibility and is familiar to administrators from older systems.
PARAMETERS
-n
Show numeric addresses instead of resolving hostnames; speeds up display by avoiding DNS lookups-v
Verbose output-e
Display routing table in netstat(8) format; use -ee for extended output including MTU, window, and irtt columns-C
Operate on the kernel routing cache instead of the FIB-N
Show symbolic network names rather than CIDR notation (opposite of -n)-4
Operate on IPv4 routes (alias for -A inet)-6
Operate on IPv6 routes (alias for -A inet6)-A family
Specify address family (e.g., inet, inet6)-F
Operate on the kernel FIB (Forwarding Information Base) routing table (default)-V, --version
Display version informationadd
Add a new routedel
Delete a route-net
Target is a network address-host
Target is a single host addressgw gateway
Route packets via the specified gateway; the gateway must already be reachablenetmask mask
Specify the subnet mask for a network routedev interface
Force the route to be associated with the specified network interfacemetric N
Set the metric (priority) for the route; lower values are preferredmss M
Set the TCP Maximum Segment Size (MSS) in bytes for connections using this routewindow W
Set the TCP window size in bytes for connections using this routeirtt I
Set the initial round-trip time in milliseconds (1–12000) used by TCP for this routereject
Install a blocking route that causes lookups to fail with "Network unreachable"; useful for preventing traffic to specific destinationsmod, dyn, reinstate
Diagnostic flags set by routing daemons to mark dynamic or modified routes; not normally used manually
OUTPUT COLUMNS
Destination: Target network or host addressGateway: Next-hop gateway address; `*` means the destination is directly reachable (no gateway needed)Genmask: Subnet mask for the destination; `255.255.255.255` for host routes, `0.0.0.0` for the default routeFlags: Route state flags — U=up, H=host route, G=uses a gateway, R=reinstated, D=dynamically installed, M=modified by routing daemon, A=installed by addrconf, !=reject routeMetric: Distance to the target, typically in hops; lower values are preferred when multiple routes matchRef: Number of references to this route (not used in Linux; always 0)Use: Count of route lookupsIface: Network interface used to send packets on this route
CAVEATS
Route changes made with route are not persistent across reboots. Use network configuration files or a network manager (such as NetworkManager or systemd-networkd) for permanent routes.The route command is deprecated in favor of ip route from the iproute2 package, which offers more features and a consistent syntax.The specified gateway must be reachable before adding a route through it; set up a direct route to the gateway first if necessary.Modifying routes requires root privileges. Incorrect routing configuration can cause complete loss of network connectivity.
SEE ALSO
ip(8), ip-route(8), ifconfig(8), netstat(8), traceroute(8)
