oreilly.comSafari Books Online.Conferences.


Linux in a Nutshell

This directory of Linux commands is from Linux in a Nutshell, 5th Edition.

Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.

Buy it now, or read it online on Safari Bookshelf.


route [options] [command]

TCP/IP command. Add or remove entries in the routing tables maintained by routed. route accepts two commands: add, to add a route, and del, to delete a route. The two commands have the following syntax:

add [-net | -host] address [modifiers] del [-net | -host] address [modifiers]

address is treated as a plain route, unless -net is specified or address is found in /etc/networks. -host can be used to specify that address is a plain route whether or not it is found in /etc/networks. Using route modifiers, you can specify the gateway through which to route packets headed for that address, its netmask, TCP mss, or the device with which to associate the route; you can also mask certain routes. Only a privileged user may modify the routing tables.

If no command is specified, route prints the routing tables.


-A family, --family

Specify an address family to use with an add or del command. family may be inet, inet6, ax25, netrom, ipx, ddp, or x25.

-C, --cache

Perform command on the routing cache instead of the forwarding information base (FIB) routing table.

-e, --extend

Use netstat -r format to print routing table. Use twice to print extended information. Same as netstat -ree.

-F, --fib

Perform command on the forwarding information base (FIB) routing table. This is the default behavior.

-h, --help

Print help message, then exit.

-n, --numeric

Show numerical addresses; do not look up hostnames. (Useful if DNS is not functioning properly.)

-v, --verbose

Verbose mode.

-V, --version

Print version and configuration options, then exit.

Route modifiers

[dev] interface

Associate route with specified device. When the interface is given as the last argument on a command line, the word dev is optional.

netmask mask

Use netmask mask.

gw gateway

Route packets through gateway.

metric n

Set routing metric to n.

mss bytes

Set maximum segment size for connections over this route.


Cause route lookup for target to fail. Used to mask out networks from a default route.


Add a default gateway for interface eth0:

route add default gw dev eth0

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: