MikeL's FreeBSD howto - Static Routes

The syntax for setting up static routes is not real obvious. For each route, you make up a name, and list these names. Then you make a command with eqach of these names following the word "route_". These commands are then passed, one at a time to the 'route' command, following the 'add' arg. (See /etc/rc.network.)

For example, the following entries in the rc.conf:

static_routes="00 16 32"
route_00=" -net 16.64.0.0 -interface 16.64.64.21"
route_16=" -net 16.64.16.0 -interface 16.64.64.21"
route_32=" -net 16.64.32.0 -interface 16.64.64.21"
will perform the following commands:
route add  -net 16.64.0.0 -interface 16.64.64.21
route add  -net 16.64.16.0 -interface 16.64.64.21
route add  -net 16.64.32.0 -interface 16.64.64.21
This specific example allows this system to see computers with addresses of 16.64.0.*, 16.64.16.*, and 16.64.32.* via the NIC with the address 16.64.64.21.

Copyright © 1995-1998 Mike Lempriere