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