route
Hurricane Electric Internet Services
NAME
route - show / manipulate the IP routing table
SYNOPSIS
route [ -vn ]
route [ -v ] add [ -net | -host ] XXXX [gw GGGG]
[metric MMMM] [netmask NNNN] [mss NNNN] [window
NNNN] [dev DDDD]
route [ -v ] del XXXX
DESCRIPTION
Route manipulates the kernel's IP routing table. Its pri-
mary 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 0.99pl14n and
newer kernels.
OPTIONS
(none) prints out the kernel routing table, listing desti-
nation address, gateway, netmask for route ("Gen-
mask"), flags (U = Up, H = Host, G = Gateway, D =
dynamic, M = Modified), Metric (currently not sup-
ported), Ref, Use and Iface (i.e. which device the
route maps to).
-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).
del XXXX
deletes the route associated with the destination
address XXXX.
add [ -net | -host ] XXXX [gw GGGG] [metric MMMM] [netmask
NNNN] [window WWWW] [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 getnetby-
name() 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 speci-
fied 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 warn-
ing).
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 net-
mask is given, route guesses it instead, so for
most normal setups you won't need to specify a net-
mask.
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 dev DDDD modifier forces the route to be asso-
ciated 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 desti-
nation address) and associated with the lo device
(assuming this device was prviously set up cor-
rectly 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 neces-
sary 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 (multi-
cast) IP routes to go via eth0. This is the correct
normal configuration line with a multicasting ker-
nel.
FILES
/proc/net/route
/etc/networks
/etc/hosts
SEE ALSO
ifconfig(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.
BUGS
Alan needs to add the 'irtt' option for an initial round
trip time for slow (AX.25/NetROM) links. Unfortunately he
has to get around to adding it to the kernel first.
Hurricane Electric Internet Services
Copyright (C) 1998
Hurricane Electric.
All Rights Reserved.