ROUTE(8)

NAME
route - show / manipulate the IP routing table

SYNOPSIS
route [ -vn ]

route [ -vee ] add [ -net | -host ] XXXX [gw GGGG] [metric MMMM] [netmask NNNN] [mss NNNN] [window NNNN] [reject] [dev DDDD]

route [ -v ] del XXXX

DESCRIPTION
Route manipulates the kernel's IP routing table. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig(8) program. This version of route is intended solely for use with kernel versions 1.3.20 and newer kernels.

OPTIONS

(none)
    prints out the kernel routing table, listing destination address, gateway, netmask for route ("Genmask"), flags (U = Up, H = Host, G = Gateway, D = dynamic, M = Modified, ! = Reject, R = Reinstat), Metric, Ref (not supported), Use and Iface.

-n  same as previous, but shows numerical addresses instead of trying to determine symbolic host names. This is useful if you are trying to determine why the route to your nameserver has vanished.

-v  is a flag for verbose (not actually used).

-e  use netstat(8) -format for displaying the routing table. -ee will generate a very long line with all parametres from the routing table.

del XXXX
    deletes the route associated with the destination address XXXX.

add [ -net | -host ] XXXX [gw GGGG] [metric MMMM] [netmask NNNN] [window WWWW] [irtt IIII] [dev DDDD]
    adds a route to the IP address XXXX. The route is a network route if (a) the -net modifier is used or (b) XXXX is found in /etc/networks by the getnetbyname() library function and no -host modifier is used. The gw GGGG argument means that any IP packets sent to this address will be routed through the specified gateway. NOTE: The specified gateway must be reachable first. This usually means that you have to set up a static route to the gateway beforehand. The metric MMMM modifier is not yet implemented (and with the -v option will actually print a warning). The netmask NNNN modifier specifies the netmask of the route to be added. This only makes sense for a network route, and when the address XXXX actually makes sense with the specified netmask. If no netmask is given, route guesses it instead, so for most normal setups you won't need to specify a netmask. The mss NNNN modifier specifies the TCP mss for the route to be added. This is normally used only for fine optimisation of routing setups. The window NNNN modifier specifies the TCP window for the route to be added. This is typically only used on AX.25 networks and with drivers unable to handle back to back frames. The irtt IIII modifier specifies the initial round trip time used for TCP Connections. This is typically only used on AX.25 networks. The number is given in ms (1-12000). If ommited the RFC 1122 default of 300ms is used. The reject modifier installs a reject route, which will force a route lookup to fail. This is for example used to mask out networks before using the default route. This should not be used for firewalling. The dev DDDD modifier forces the route to be associated with the specified device, as the kernel will otherwise try to determine the device on its own (by checking already existing routes and device specifications, and where the route is added to). In most normal networks you won't need this. If dev DDDD is the last option on the command line, the word dev may be omitted, as it's the default. Otherwise the order of the route modifiers (metric - netmask - gw - dev) doesn't matter.

EXAMPLES

route add -net 127.0.0.0
    adds the normal loopback entry, using netmask 255.0.0.0 (Class A net, determined from the destination address) and associated with the lo device (assuming this device was prviously set up correctly with ifconfig(8) ).

route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0
    adds a route to the network 192.56.76.x via eth0. The Class C netmask modifier is not really necessary here because 192.* is a Class C IP address. The word dev can be omitted here.

route add default gw mango-gw
    adds a default route (which will be used if no other route matches). All packets using this route will be gatewayed through "mango-gw". The device which will actually be used for that route depends on how we can reach "mango-gw" - the static route to "mango-gw" will have to be set up before.

route add ipx4 sl0

route add -net 192.57.66.0 netmask 255.255.255.0 gw ipx4
    This command sequence adds the route to the "ipx4" host via the SLIP interface (assuming that "ipx4" is the SLIP host), and then adds the net 192.57.66.0 to be gatewayed through that host.

route add 224.0.0.0 netmask 240.0.0.0 dev eth0
    This is an obscure one documented so people know how to do it. This sets all of the class D (multicast) IP routes to go via eth0. This is the correct normal configuration line with a multicasting kernel.

FILES
/proc/net/route
/etc/networks
/etc/hosts

SEE ALSO
ifconfig(8), netstat(8), arp(8)

HISTORY
Route for Linux was originally written by Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> and then modified by Johannes Stille and Linus Torvalds for pl15. Alan Cox added the mss and window options for Linux 1.1.22. irtt support and merged with netstat from Bernd Eckenfels.

BUGS
none :)