[Next] [Previous] [Up] [Top] [Contents]

19.4 Network Programs

19.4.3 route - Network Routing

Normally you would just use the default route to get to one of the network routers (or the server for your subnet) and not have to worry about managing the network routing tables on your system. You can have the system set the default route on startup by placing the IP address of the default router in the file /etc/defaultrouter. If you do need to manage the network routing tables then you can run the network routing daemon, in.routed. This will be started for you through the RC scripts if no default route exists (i.e. /etc/defaultrouter is empty or non-existent).


route [ options ] [ add|delete ] [ host|net] destination [ gateway [ metric ] ]

Common Options

-f flush the routing tables

-n don't map the IP addresses to host names

add|delete add, or delete, a route to the destination

host|net interpret the destination as a host or network, respectively

destination network destination address

gateway the network gateway address through which packets are sent

metric number of hops to destination, required with the add option. A metric of 0 indicates an interface on the local machine; specify this if all destinations are local. A metric of 1 indicates it's on the local subnet.


To add the server as the default router for a workstation, first kill the route daemon on the workstation, if it's running, then flush the existing route with:

# route -f

Lastly, add the default route for the interface:

# route add default 1

where default is the designation used to indicate the destination address for all non-local packets, is the address of the router for the sub-net, and it is 1 hop away.

Unix System Administration - 8 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]