[BACK]Return to route.conf.5 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / man / man5

File: [cvs.NetBSD.org] / src / share / man / man5 / route.conf.5 (download)

Revision 1.3.20.1, Mon May 7 03:16:44 2012 UTC (11 years, 11 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Changes since 1.3: +16 -6 lines

Pull up following revision(s) (requested by gendalia in ticket #211):
	share/man/man5/route.conf.5: revision 1.4
	etc/rc.d/staticroute: revision 1.6
Add the ability for staticroute to evaluate lines from /etc/route.conf
as shell script fragments, add example to the route.conf man page of
evaluating variables.
Remove route.conf man page statement that staticroute is enabled in
rc.conf since that's incorrect.
Wrap the staticroute while in parens, per <apb> & <christos>, and
quote all the arguments for the evals.

.\"        $NetBSD: route.conf.5,v 1.3.20.1 2012/05/07 03:16:44 riz Exp $
.\"
.\" Copyright (c) 2004 Thomas Klausner
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd May 1, 2012
.Dt ROUTE.CONF 5
.Os
.Sh NAME
.Nm route.conf
.Nd static routes config file
.Sh DESCRIPTION
The
.Nm
file is read by the
.Pa staticroute
rc.d script during system start-up and shutdown,
and is intended for adding and removing static routes.
.Ss FILE FORMAT
Lines starting with a hash
.Pq Sq #
are comments and ignored.
Lines starting with a plus sign
.Pq Sq +
are run during start-up,
while lines starting with a minus sign
.Pq Sq \-
are run during system shutdown.
If a line starts with a
.Sq \&! ,
the rest of the line will get evaluated as a shell script fragment.
All other lines are passed to
.Xr route 8 .
During start-up, they are passed behind a
.Dq Ic route add \-
command and during shutdown behind a
.Dq Ic route delete \-
command.
.Sh FILES
.Bl -tag -width XXetcXrouteXconfXX
.It Pa /etc/route.conf
The
.Nm
file resides in
.Pa /etc .
.It Pa /etc/rc.d/staticroute
.Xr rc.d 8
script that parses
.Nm .
.El
.Sh EXAMPLES
In this example, the interface for the desired routing changes is set,
the IP address on that interface is determined, and a route is added
during startup, or deleted during system shutdown.
.Bd -literal -offset indent 
# Set interface and determine current IP address for added route.
!ifname=bnx0
!ipaddr=$(/sbin/ifconfig ${ifname} | awk '$1 == "inet" {print $2}')
net 10.10.1 -interface ${ipaddr}
.Ed
.Pp
In this example,
IP forwarding is turned on during
start-up, and a static route added for 192.168.2.0.
During system shutdown, the route is removed
and IP forwarding turned off.
.Bd -literal -offset indent
# Turn on/off IP forwarding.
+sysctl -w net.inet.ip.forwarding=1
-sysctl -w net.inet.ip.forwarding=0
net 192.168.2.0 -netmask 255.255.255.0 192.168.150.2
.Ed
.Sh SEE ALSO
.Xr rc.conf 5 ,
.Xr rc 8 ,
.Xr route 8