xref: /netbsd/share/man/man5/ifconfig.if.5 (revision c4a72b64)
1.\"	$NetBSD: ifconfig.if.5,v 1.7 2002/10/13 00:46:59 wiz Exp $
2.\"
3.\" Copyright (c) 1996 Matthew R. Green
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. The name of the author may not be used to endorse or promote products
15.\"    derived from this software without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.Dd October 5, 2002
30.Dt IFCONFIG.IF 5
31.Os
32.Sh NAME
33.Nm ifconfig.if
34.Nd interface-specific configuration files
35.Sh DESCRIPTION
36The
37.Nm
38files contain information regarding the configuration of each network interface.
39.Nm
40is processed by
41.Pa /etc/rc.d/network
42at system boot time.
43.Pp
44One file should exist for each interface that is to be configured, such as
45.Pa /etc/ifconfig.fxp0 .
46The file will get evaluated only if the interface exists on the system.
47Multiple lines can be placed in a file, and will be evaluated sequentially.
48.Pp
49Normally, a line will be evaluated as command line arguments to
50.Xr ifconfig 8 .
51.Dq Li ifconfig if
52will be prepended on evaluation.
53.Pp
54If a line is empty, or starts with
55.Sq # ,
56the line will be ignored as comment.
57.Pp
58If a line starts with
59.Sq \&! ,
60the rest of line will get evaluated as shell script fragment.
61Shell variables declared in
62.Pa /etc/rc.d/network
63are accessible.
64The most useful variable is
65.Li $int ,
66as it will be bound to the interface being configured with the file.
67.Pp
68For example, the following illustrates static interface configuration:
69.Bd -literal -offset indent
70# IPv4, with an alias
71inet 10.0.1.12 netmask 255.255.255.0 media 100baseTX
72inet 10.0.1.13 netmask 255.255.255.255 alias
73# let us have IPv6 address on this interface
74inet6 fec0::1 prefixlen 64 alias
75# have subnet router anycast address too
76inet6 fec0:: prefixlen 64 alias anycast
77.Ed
78.Pp
79The following illustrates dynamic configuration setup with
80.Xr dhclient 8
81and
82.Xr rtsol 8 :
83.Bd -literal -offset indent
84up
85# autoconfigure IPv4 address
86!dhclient $int
87# autoconfigure IPv6 address.  Be sure to set $ip6mode to autohost.
88!rtsol $int
89.Ed
90.Pp
91The following example is for dynamically-created pseudo interfaces like
92.Xr gif 4 :
93.Bd -literal -offset indent
94up
95# configure IPv6 default route toward the interface
96!route add -inet6 default ::1
97!route change -inet6 default -ifp $int
98.Ed
99.Pp
100Earlier versions of
101.Pa /etc/rc.d/network
102required an explicit
103.Sq create
104command for such interfaces.
105This is now handled automatically.
106.Sh FILES
107.Pa /etc/rc.d/network
108.Sh SEE ALSO
109.Xr rc.conf 5 ,
110.Xr ifconfig 8
111