jkwong
August 16th, 2005, 12:38
i figured out how to add a route, route add -net 10.10.0.0/24 10.1.0.1
but when i reboot the machine, i lost my route and then i have to get back on to the console and re-add it.
i tried man route and googled for it, which actually led me back here!
Thanks!
bsdjunkie
August 16th, 2005, 13:37
From the fbsd handbook:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-routing.html
route(8) ("]26.2.5.2 Persistent Configuration[/url]
The above example is perfect for configuring a static route on a running system. However, one problem is that the routing information will not persist if you reboot your FreeBSD machine. The way to handle the addition of a static route is to put it in your /etc/rc.conf file:
# Add Internal Net 2 as a static route
static_routes="internalnet2"
route_internalnet2="-net 192.168.2.0/24 192.168.1.2"
The static_routes configuration variable is a list of strings separated by a space. Each string references to a route name. In our above example we only have one string in static_routes. This string is internalnet2. We then add a configuration variable called route_internalnet2 where we put all of the configuration parameters we would give to the [url="http://www.FreeBSD.org/cgi/man.cgi?query=route&sektion=8) command. For our example above we would have used the command:
# route add -net 192.168.2.0/24 192.168.1.2 so we need "-net 192.168.2.0/24 192.168.1.2".
As said above, we can have more than one string in static_routes. This allows us to create multiple static routes. The following lines shows an example of adding static routes for the 192.168.0.0/24 and 192.168.1.0/24 networks on an imaginary router:
static_routes="net1 net2"
route_net1="-net 192.168.0.0/24 192.168.0.1"
route_net2="-net 192.168.1.0/24 192.168.1.1"
Watabe
August 20th, 2005, 13:47
static_routes="net1 net2"
route_net1="-net 192.168.0.0/24 192.168.0.1"
route_net2="-net 192.168.1.0/24 192.168.1.1"
Well, that's it ... just add these line in your /etc/rc.conf ... of course you'll have to change them to fit your needs :)