NetBSD/share/man/man5/ifconfig.if.5

105 lines
3.5 KiB
Groff

.\" $NetBSD: ifconfig.if.5,v 1.4 2001/11/23 18:40:59 wiz Exp $
.\"
.\" Copyright (c) 1996 Matthew R. Green
.\" 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.
.\" 3. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" 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 January 12, 2001
.Dt IFCONFIG.IF 5
.Os
.Sh NAME
.Nm ifconfig.if
.Nd interface-specific configuration files
.Sh DESCRIPTION
The
.Nm
files contain information regarding the configuration of each network interface.
.Nm
is processed by
.Pa /etc/rc.d/network
at system boot time.
.Pp
One file should exist for each interface that is to be configured, such as
.Pa /etc/ifconfig.fxp0 .
The file will get evaluated only if the interface exists on the system.
Multiple lines can be placed in a file, and will be evaluated sequentially.
.Pp
Normally, a line will be evaluated as command line arguments to
.Xr ifconfig 8 .
.Dq Li ifconfig if
will be prepended on evaluation.
.Pp
If a line is empty, or starts with
.Sq # ,
the line will be ignored as comment.
.Pp
If a line starts with
.Sq \&! ,
the rest of line will get evaluated as shell script fragment.
Shell variables declared in
.Pa /etc/rc.d/network
are accessible.
The most useful variable is
.Li $int ,
as it will be bound to the interface being configured with the file.
.Pp
For example, the following illustrates static interface configuration:
.Bd -literal -offset indent
# IPv4, with an alias
inet 10.0.1.12 255.255.255.0 media 100baseTX
inet 10.0.1.13 255.255.255.255 alias
# let us have IPv6 address on this interface
inet6 fec0::1 prefixlen 64 alias
# have subnet router anycast address too
inet6 fec0:: prefixlen 64 alias anycast
.Ed
.Pp
The following illustrates dynamic configuration setup with
.Xr dhclient 8
and
.Xr rtsol 8 :
.Bd -literal -offset indent
up
# autoconfigure IPv4 address
!dhclient $int
# autoconfigure IPv6 address. be sure to set $ip6mode to autohost.
!rtsol $int
.Ed
.Pp
The following example is for dynamically-created pseudo interfaces like
.Xr gif 4 :
.Bd -literal -offset indent
create
up
# configure IPv6 default route toward the interface
!route add -inet6 default ::1
!route change -inet6 default -ifp $int
.Ed
.Sh FILES
.Pa /etc/rc.d/network
.Sh SEE ALSO
.Xr rc.conf 5 ,
.Xr ifconfig 8