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.
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.
Add a default gateway for interface eth0:
route add default gw 192.168.0.1 dev eth0