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