xref: /openbsd-src/share/man/man5/hostname.if.5 (revision 8500990981f885cbe5e6a4958549cacc238b5ae6)
1.\"	$OpenBSD: hostname.if.5,v 1.34 2003/09/02 18:37:08 jmc Exp $
2.\"	$NetBSD: hosts.5,v 1.4 1994/11/30 19:31:20 jtc Exp $
3.\"
4.\" Copyright (c) 1983, 1991, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)hosts.5	8.2 (Berkeley) 12/11/93
32.\"
33.Dd September 2, 1999
34.Dt HOSTNAME.IF 5
35.Os
36.Sh NAME
37.Nm hostname.if
38and
39.Nm bridgename.if
40.Nd interface-specific configuration files
41.Sh DESCRIPTION
42The
43.Nm hostname.*
44and
45.Nm bridgename.*
46files contain information regarding the configuration of each network interface.
47One file should exist for each interface that is to be configured, such as
48.Pa hostname.fxp0
49or
50.Pa bridgename.bridge0 .
51However, a configuration file is not needed for lo0.
52Note that multiple entries can be used per configuration file.
53.Pp
54The following three formats are valid for
55.Nm hostname.*
56files.
57.Pp
58Regular ipv4 network setup:
59.Bd -ragged -offset indent
60.Va addr_family
61.Op Va alias
62.Va addr
63.Va netmask
64.Va broadcast_addr
65.Va options
66.br
67.Li dest
68.Va dest_addr
69.Ed
70.Pp
71Regular ipv6 network setup:
72.Bd -ragged -offset indent
73.Va addr_family
74.Op Va alias
75.Va addr
76.Va prefixlen
77.Va options
78.Ed
79.Pp
80Other network setup:
81.Bd -ragged -offset indent
82.Va addr_family
83.Va options
84.Ed
85.Pp
86A typical file contains only one line, but more extensive files are possible,
87for example:
88.Bd -literal -offset indent
89inet 10.0.1.12 255.255.255.0 10.0.1.255 media 100baseTX
90inet alias 10.0.1.13 255.255.255.255 10.0.1.13
91inet alias 10.0.1.14 255.255.255.255 NONE
92inet alias 10.0.1.15 255.255.255.255
93inet alias 10.0.1.16 0xffffffff
94inet6 alias fec0::1 64
95inet6 alias fec0::2 64 anycast
96# This is an example comment line.
97!wicontrol \e$if -t 2  # Set to 2Mbps
98.Ed
99.Pp
100The above formats have the following field values:
101.Bl -tag -width indent -offset indent
102.It Va addr_family
103The address family of the interface, generally
104.Dq inet
105or
106.Dq inet6 .
107.It Va addr
108The optional address that belongs to the interface, such as
109190.191.192.1 or fe80:2::1 .
110It is also feasible to use a hostname as specified in
111.Pa /etc/hosts .
112It is recommended that an address be used instead of symbolic information,
113since the latter might activate
114.Xr resolver 3
115library routines.
116.Pp
117If no address is specified, the
118.Va netmask ,
119.Va broadcast_addr ,
120.Li dest ,
121and
122.Va dest_addr
123options are invalid and will be ignored.
124.It Va netmask
125The optional network mask for the interface, i.e.,
126255.255.255.0.
127.It Va broadcast_addr
128The optional broadcast address for the interface, i.e.,
129190.191.192.255
130.It Va options
131Optional miscellaneous options to set on the interface, i.e.,
132.Dq media 100baseTX mediaopt full-duplex .
133.It Li dest
134If the interface needs a destination address set, this is the literal text
135.Dq dest .
136As shown in the example, this declaration should start on a separate line.
137.It Va dest_addr
138The destination address to be set on the interface, such as
139190.191.192.2.
140It is also feasible to use a hostname as specified in
141.Pa /etc/hosts .
142It is recommended that an address be used instead of symbolic information
143which might activate
144.Xr resolver 3
145library routines.
146.It Va prefixlen
147The prefixlen number, or number of bits in the netmask, to be set on
148the interface, such as 64.
149.It Li #
150Comments are allowed.
151Anything following a comment character is treated as a comment.
152.It Li \&! Ns Ar command-line
153Arbitrary shell commands can be executed using this directive.
154Useful for doing interface specific configuration using commands like
155.Xr wicontrol 8 ,
156setting up custom routes using
157.Xr route 8 ,
158or establishing tunnels using
159.Xr ifconfig 8 .
160It is worth noting that
161.Dq \e$if
162in a command line will be replaced by the interface name.
163.El
164.Pp
165A DHCP-configured network interface setup consists of
166.Bd -ragged -offset indent
167.Li dhcp
168.Va options
169.Ed
170.Pp
171For example,
172.Bd -literal -offset indent
173dhcp media 100baseTX mediaopt full-duplex
174.Ed
175.Pp
176The above format has the following field values:
177.Bl -tag -width indent -offset indent
178.It Li dhcp
179The literal string
180.Dq dhcp
181if the interface is to be configured using DHCP.
182See
183.Xr dhclient 8
184and
185.Xr dhclient.conf 5
186for more details.
187.It Va options
188Optional miscellaneous options to set on the interface, i.e.,
189.Dq media 100baseTX mediaopt full-duplex .
190.El
191.Pp
192IPv6 stateless address autoconfiguration:
193.Bd -ragged -offset indent
194.Li rtsol
195.Va options
196.Ed
197.Pp
198The above format has the following field values:
199.Bl -tag -width indent -offset indent
200.It Li rtsol
201The literal string
202.Dq rtsol
203if the interface is to be configured using
204IPv6 stateless address autoconfiguration.
205This should be used on single interface hosts only,
206since the IPv6 specifications are silent about the
207behavior on multi-interface hosts.
208Also note that the kernel must be configured to accept IPv6
209router advertisement, and configured as a host (ie. non-router).
210Add the following lines into
211.Xr sysctl.conf 5 :
212.Bd -literal -offset indent
213net.inet6.ip6.forwarding=0
214net.inet6.ip6.accept_rtadv=1
215.Ed
216.It Va options
217Optional miscellaneous options to set on the interface, e.g.,
218.Dq media 100baseTX mediaopt full-duplex .
219.El
220.Pp
221An addressless network interface setup (useful for
222.Xr bridge 4
223member interfaces and interfaces to be used with
224.Xr pppoe 8 )
225consists of
226.Bd -ragged -offset indent
227.Li up
228.Va options
229.Ed
230.Pp
231The above format has the following field values:
232.Bl -tag -width indent -offset indent
233.It Li up
234The literal string
235.Dq up
236if the interface is to be simply brought up.
237.It Va options
238Optional miscellaneous options to set on the interface, e.g.,
239.Dq media 100baseTX mediaopt full-duplex .
240.El
241.Pp
242The final file format only applies to
243.Nm bridgename.bridge*
244files.
245A bridge interface setup consists of
246.Bd -ragged -offset indent
247.Va brconfig-arguments
248.br
249.Va brconfig-arguments
250.br
251\&...
252.Ed
253.Pp
254For example,
255.Bd -literal -offset indent
256add fxp0
257add ep1
258-learn fxp0
259#
260!ipsecadm flush
261#
262static fxp0 8:0:20:1e:2f:2b
263up    # and finally enable it
264.Ed
265.Pp
266The options are as follows:
267.Bl -tag -width indent -offset indent
268.It Va brconfig-arguments
269.Xr brconfig 8
270is called for each successive line.
271Comments starting with
272.Ql #
273and commands to be executed
274prefixed by
275.Ql \&!
276are permitted.
277.El
278.Sh SEE ALSO
279.Xr hosts 5 ,
280.Xr ancontrol 8 ,
281.Xr brconfig 8 ,
282.Xr dhcp 8 ,
283.Xr ifconfig 8 ,
284.Xr lmccontrol 8 ,
285.Xr netstart 8 ,
286.Xr rc 8 ,
287.Xr spppcontrol 8 ,
288.Xr wicontrol 8
289