route is a
Unix command which is used to
display or modify the
routing table. "route" typed on its own will display the routing
table (you can also do this by typing "
netstat -r"). To modify the
routing table, use the
add or
del option to route. For example,
here's how I'd set up the routing table on one of my
Linux machines.
(Actually, the Debian
install process asked me a few questions about
my IP address, netmask and
gateway, then ran these commands for me.)
route add -net 131.111.0.0 netmask 255.255.0.0
This sets up a local route - every machine with an IP address
beginning with 131.111 is deemed to be local, and is communicated with
directly, not via a gateway. See understanding subnets and
netmasks for a detailed explanation of how the computer determines
whether the destination IP address matches a route.
route add default gw 131.111.20.62
This sets up a default route. Any machine with an IP address which
does not begin with 131.111 is not local, and packets for it will be
sent via the gateway at 131.111.20.62. The gateway itself is local
and is accessed using the first route.