xref: /openbsd-src/share/man/man5/hostname.if.5 (revision a28daedfc357b214be5c701aa8ba8adb29a7f1c2)
1.\"	$OpenBSD: hostname.if.5,v 1.52 2008/01/31 20:00: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 $Mdocdate: January 31 2008 $
34.Dt HOSTNAME.IF 5
35.Os
36.Sh NAME
37.Nm hostname.if ,
38.Nm bridgename.if
39.Nd interface-specific configuration files
40.Sh DESCRIPTION
41The
42.Nm hostname.*\&
43and
44.Nm bridgename.*\&
45files contain information regarding the configuration of each network interface.
46One file should exist for each interface that is to be configured, such as
47.Pa hostname.fxp0
48or
49.Pa bridgename.bridge0 .
50However, a configuration file is not needed for lo0.
51.Pp
52Arguments containing either whitespace or single quote
53characters must be double quoted.
54For example:
55.Bd -literal -offset indent
56inet 10.0.0.1 255.255.255.0 10.0.0.255 description "Bob's uplink"
57.Ed
58.Sh STATIC ADDRESS CONFIGURATION
59The following three
60.Nm hostname.*\&
61formats are valid for configuring network interfaces with static
62addresses:
63.Pp
64Regular IPv4 network setup:
65.Bd -ragged -offset indent
66.Li inet
67.Op Li alias
68.Va addr
69.Va netmask
70.Va broadcast_addr
71.Va options
72.br
73.Li dest
74.Va dest_addr
75.Ed
76.Pp
77Regular IPv6 network setup:
78.Bd -ragged -offset indent
79.Li inet6
80.Op Li alias
81.Va addr
82.Va prefixlen
83.Va options
84.br
85.Li dest
86.Va dest_addr
87.Ed
88.Pp
89Other network setup:
90.Bd -ragged -offset indent
91.Va addr_family
92.Va options
93.Ed
94.Pp
95A typical file contains only one line, but more extensive files are possible,
96for example:
97.Bd -literal -offset 1n
98inet 10.0.1.12 255.255.255.0 10.0.1.255 media 100baseTX description Uplink
99inet alias 10.0.1.13 255.255.255.255 10.0.1.13
100inet alias 10.0.1.14 255.255.255.255 NONE
101inet alias 10.0.1.15 255.255.255.255
102inet alias 10.0.1.16 0xffffffff
103# This is an example comment line.
104inet6 alias fec0::1 64
105inet6 alias fec0::2 64 anycast
106.Ed
107.Pp
108The above formats have the following field values:
109.Bl -tag -width indent -offset indent
110.It Va addr_family
111The address family of the interface, generally
112.Dq inet
113or
114.Dq inet6 .
115.It Li alias
116The literal string
117.Dq alias
118if this is an additional network address for the interface.
119.It Va addr
120The optional address that belongs to the interface, such as
121190.191.192.1 or fe80:2::1.
122It is also feasible to use a hostname as specified in
123.Pa /etc/hosts .
124It is recommended that an address be used instead of symbolic information,
125since the latter might activate
126.Xr resolver 3
127library routines.
128.Pp
129If no address is specified, the
130.Va netmask ,
131.Va broadcast_addr ,
132.Li dest ,
133and
134.Va dest_addr
135options are invalid and will be ignored.
136.It Va netmask
137The optional network mask for the interface, e.g.,
138255.255.255.0.
139If
140.Va addr
141is specified but
142.Va netmask
143is not, the classful mask based on
144.Va addr
145is used.
146.It Va broadcast_addr
147The optional broadcast address for the interface, e.g.,
148190.191.192.255.
149The word
150.Dq NONE
151can also be specified in order to configure the broadcast address based
152on the
153.Va netmask .
154The
155.Va netmask
156option must be present in order to use this option.
157.It Va options
158Miscellaneous options to set on the interface, e.g.,
159.Dq media 100baseTX mediaopt full-duplex .
160Valid options for a particular interface type can be found in
161.Xr ifconfig 8 .
162When used, the
163.Va netmask
164and
165.Va broadcast_addr
166options must also be present.
167.It Li dest
168If the interface needs a destination address set, this is the literal text
169.Dq dest .
170As shown in the example, this declaration should start on a separate line.
171.It Va dest_addr
172The destination address to be set on the interface, such as
173190.191.192.2.
174It is also feasible to use a hostname as specified in
175.Pa /etc/hosts .
176It is recommended that an address be used instead of symbolic information
177which might activate
178.Xr resolver 3
179library routines.
180.It Va prefixlen
181The prefixlen number, or number of bits in the netmask, to be set on
182the interface, such as 64.
183.It Li #
184Comments are allowed.
185Anything following a comment character is treated as a comment.
186.It Li \&! Ns Ar command-line
187Arbitrary shell commands can be executed using this directive.
188Useful for doing interface-specific configuration such as
189setting up custom routes using
190.Xr route 8
191or establishing tunnels using
192.Xr ifconfig 8 .
193It is worth noting that
194.Dq \e$if
195in a command line will be replaced by the interface name.
196.El
197.Sh DYNAMIC ADDRESS CONFIGURATION
198The following
199.Nm hostname.*\&
200formats are valid for configuring network interfaces with dynamic
201addresses:
202.Pp
203A DHCP-configured network interface setup consists of
204.Bd -ragged -offset indent
205.Li dhcp
206.Va options
207.Ed
208.Pp
209For example:
210.Bd -literal -offset indent
211dhcp media 100baseTX mediaopt full-duplex
212.Ed
213.Pp
214The above format has the following field values:
215.Bl -tag -width indent -offset indent
216.It Li dhcp
217The literal string
218.Dq dhcp
219if the interface is to be configured using DHCP.
220See
221.Xr dhclient 8
222and
223.Xr dhclient.conf 5
224for more details.
225.It Va options
226Miscellaneous options to set on the interface, e.g.,
227.Dq media 100baseTX mediaopt full-duplex .
228Valid options for a particular interface type can be found in
229.Xr ifconfig 8 .
230The
231.Ox
232installation script will create
233.Nm hostname.if
234with options of
235.Dq NONE NONE NONE
236when DHCP configuration is chosen.
237This is the same as specifying just
238.Dq dhcp .
239.El
240.Pp
241IPv6 stateless address autoconfiguration:
242.Bd -ragged -offset indent
243.Li rtsol
244.Va options
245.Ed
246.Pp
247The above format has the following field values:
248.Bl -tag -width indent -offset indent
249.It Li rtsol
250The literal string
251.Dq rtsol
252if the interface is to be configured using
253IPv6 stateless address autoconfiguration.
254This should be used on single interface hosts only,
255since the IPv6 specifications are silent about the
256behavior on multi-interface hosts.
257Also note that the kernel must be configured to accept IPv6
258router advertisement, and configured as a host (i.e. non-router).
259Add the following lines into
260.Xr sysctl.conf 5 :
261.Bd -literal -offset indent
262net.inet6.ip6.forwarding=0
263net.inet6.ip6.accept_rtadv=1
264.Ed
265.It Va options
266Miscellaneous options to set on the interface, e.g.,
267.Dq media 100baseTX mediaopt full-duplex .
268Valid options for a particular interface type can be found in
269.Xr ifconfig 8 .
270.El
271.Sh ADDRESS-LESS CONFIGURATION
272A network interface that does not require an IP address
273(such as
274.Xr bridge 4
275member interfaces and interfaces to be used with
276.Xr ppp 8
277and
278.Xr pppoe 8 )
279consists of
280.Bd -ragged -offset indent
281.Va state
282.Va options
283.Ed
284.Pp
285The above format has the following field values:
286.Bl -tag -width indent -offset indent
287.It Va state
288The administrative state in which to put the interface, either
289.Dq up
290or
291.Dq down .
292.It Va options
293Miscellaneous options to set on the interface, e.g.,
294.Dq media 100baseTX mediaopt full-duplex .
295Valid options for a particular interface type can be found in
296.Xr ifconfig 8 .
297.El
298.Sh BRIDGE INTERFACE CONFIGURATION
299The final file format only applies to
300.Nm bridgename.bridge*
301files.
302A bridge interface setup consists of
303.Bd -ragged -offset indent
304.Va brconfig-arguments
305.br
306.Va brconfig-arguments
307.br
308\&...
309.Ed
310.Pp
311For example:
312.Bd -literal -offset indent
313add fxp0
314add ep1
315-learn fxp0
316#
317!ipsecctl -F
318#
319static fxp0 8:0:20:1e:2f:2b
320up    # and finally enable it
321.Ed
322.Pp
323The options are as follows:
324.Bl -tag -width indent -offset indent
325.It Va brconfig-arguments
326.Xr brconfig 8
327is called for each successive line.
328Comments starting with
329.Ql #
330and commands to be executed
331prefixed by
332.Ql \&!
333are permitted.
334.El
335.Sh SEE ALSO
336.Xr hosts 5 ,
337.Xr brconfig 8 ,
338.Xr dhcp 8 ,
339.Xr ifconfig 8 ,
340.Xr lmccontrol 8 ,
341.Xr netstart 8 ,
342.Xr rc 8
343