Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Openbsd 3.2 :Where do i add static-routes

Status
Not open for further replies.

eholmf

Technical User
May 21, 2003
2
GH
Hi,
I am an Open-BSD 3.2 newbie.Can somebody please tell me the file in which to put my static routes?.
Counting on your prompt response.
eholmf
 
route [-n] *command* [-net | -host ] *destination* *gateway*

see "man route" for commands, options, etc.
 
Sorry this is not what i am looking for.The solution you gave adds routes temporarily but i want to add the routes permanently.
 
When I've done this, I've just taken my route statement and put it in rc.local. It runs every time the server boots up.

Never had any problems doing it this way. Is there a better way anyone?

Matt M.
 
In that case, do this-
Create a file called /etc/myroutes. In this file, place all of your static routes. Put them in the form:
gateway network/netmask

eg.

10.0.0.1 10.0.3.0/24
10.0.0.1 10.0.5.0/25


Load up /etc/netstart in vi. Add the following code to handle the static routes contained in /etc/myroutes:
# Add static routes as required.
# file format is:
# gw network/mask
if [ -f /etc/myroutes ]; then
{
set -- `sed -e 's/#.*$//' /etc/myroutes |grep -v '^$'`
while [ $# -ge 2 ]; do
route -n add -net $2 $1
shift 2
done
}
fi

Hope this helps-
4ltern4te
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top