1 .\" $OpenBSD: hostname.if.5,v 1.60 2013/01/18 21:48:43 jmc Exp $
2 .\" $NetBSD: hosts.5,v 1.4 1994/11/30 19:31:20 jtc Exp $
4 .\" Copyright (c) 1983, 1991, 1993
5 .\" The Regents of the University of California. All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
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.
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
31 .\" @(#)hosts.5 8.2 (Berkeley) 12/11/93
33 .Dd $Mdocdate: January 18 2013 $
38 .Nd interface-specific configuration files
42 files contain information regarding the configuration of each network interface.
43 One file should exist for each interface that is to be configured, such as
46 .Pa hostname.bridge0 .
47 A configuration file is not needed for lo0.
49 The configuration information is expressed in a line-by-line packed format
50 which makes the most common cases simpler; those dense formats are described
52 Any lines not matching these packed formats are passed directly to
54 The packed formats are converted using a somewhat inflexible parser and
55 the administrator should not expect magic \(em if in doubt study
58 per-driver manual pages to see what arguments are permitted.
60 Arguments containing either whitespace or single quote
61 characters must be double quoted.
63 .Bd -literal -offset indent
64 inet 10.0.0.1 255.255.255.0 10.0.0.255 description "Bob's uplink"
67 Each line is processed separately and in order.
69 .Bd -literal -offset indent
75 would run ifconfig to set the nwid of the interface, run it again to set the wpakey of the interface, and then start
77 .Sh STATIC ADDRESS CONFIGURATION
78 The following packed formats are valid for configuring network
79 interfaces with static addresses:
81 Regular IPv4 network setup:
82 .Bd -ragged -offset indent
94 Regular IPv6 network setup:
95 .Bd -ragged -offset indent
107 .Bd -ragged -offset indent
112 A typical file contains only one line, but more extensive files are possible,
114 .Bd -literal -offset 1n
115 inet 10.0.1.12 255.255.255.0 10.0.1.255 media 100baseTX description Uplink
116 inet alias 10.0.1.13 255.255.255.255 10.0.1.13
117 inet alias 10.0.1.14 255.255.255.255 NONE
118 inet alias 10.0.1.15 255.255.255.255
119 inet alias 10.0.1.16 0xffffffff
120 # This is an example comment line.
121 inet6 alias fec0::1 64
122 inet6 alias fec0::2 64 anycast
123 !route add 65.65.65.65 10.0.1.13
127 The above formats have the following field values:
128 .Bl -tag -width indent -offset indent
130 The address family of the interface, generally
137 if this is an additional network address for the interface.
139 The optional address that belongs to the interface, such as
140 190.191.192.1 or fe80:2::1.
141 It is also feasible to use a hostname as specified in
143 It is recommended that an address be used instead of symbolic information,
144 since the latter might activate
148 If no address is specified, the
154 options are invalid and will be ignored.
156 The optional network mask for the interface, e.g.,
162 is not, the classful mask based on
165 .It Va broadcast_addr
166 The optional broadcast address for the interface, e.g.,
170 can also be specified in order to configure the broadcast address based
175 option must be present in order to use this option.
177 Miscellaneous options to set on the interface, e.g.,
178 .Dq media 100baseTX mediaopt full-duplex .
179 Valid options for a particular interface type can be found in
185 options must also be present.
187 If the interface needs a destination address set, this is the literal text
189 As shown in the example, this declaration should start on a separate line.
191 The destination address to be set on the interface, such as
193 It is also feasible to use a hostname as specified in
195 It is recommended that an address be used instead of symbolic information
200 The prefixlen number, or number of bits in the netmask, to be set on
201 the interface, such as 64.
203 Comments are allowed.
204 Anything following a comment character is treated as a comment.
205 .It Li \&! Ns Ar command
206 Arbitrary shell commands can be executed using this directive, as
207 long as they are available in the single-user environment (for
212 Useful for doing interface-specific configuration such as
213 setting up custom routes using
215 or establishing tunnels using
217 It is worth noting that
219 in a command line will be replaced by the interface name.
221 .Sh DYNAMIC ADDRESS CONFIGURATION
222 The following packed formats are valid for configuring network
223 interfaces with dynamic addresses:
225 A DHCP-configured network interface setup consists of
226 .Bd -ragged -offset indent
231 The above format has the following field values:
232 .Bl -tag -width indent -offset indent
236 if the interface is to be configured using DHCP.
243 Miscellaneous options to set on the interface, e.g.,
244 .Dq media 100baseTX mediaopt full-duplex .
245 Valid options for a particular interface type can be found in
249 IPv6 stateless address autoconfiguration:
250 .Bd -ragged -offset indent
255 The above format has the following field values:
256 .Bl -tag -width indent -offset indent
260 if the interface is to be configured using
261 IPv6 stateless address autoconfiguration.
262 This should be used on single interface hosts only,
263 since the IPv6 specifications are silent about the
264 behavior on multi-interface hosts.
265 Also note that the kernel must be configured to accept IPv6
266 router advertisement, and configured as a host (i.e. non-router).
267 Add the following lines into
269 .Bd -literal -offset indent
270 net.inet6.ip6.forwarding=0
271 net.inet6.ip6.accept_rtadv=1
274 Miscellaneous options to set on the interface, e.g.,
275 .Dq media 100baseTX mediaopt full-duplex .
276 Valid options for a particular interface type can be found in
279 .Sh BRIDGE INTERFACE CONFIGURATION
280 If the network interface is a bridge, the options described in
281 the bridge section of the
286 .Bd -literal -offset indent
293 static fxp0 8:0:20:1e:2f:2b
294 up # and finally enable it
297 .Bl -tag -width "/etc/hostname.XXXXXX"
298 .It Pa /etc/hostname.XXX
299 Interface-specific configuration files.