1.\" $NetBSD: ifconfig.if.5,v 1.14 2010/09/26 18:52:04 apb Exp $ 2.\" 3.\" Copyright (c) 1996 Matthew R. Green 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" SUCH DAMAGE. 26.\" 27.Dd September 26, 2010 28.Dt IFCONFIG.IF 5 29.Os 30.Sh NAME 31.Nm ifconfig.if 32.Nd interface-specific configuration files or variables 33.Sh DESCRIPTION 34The 35.Nm 36files or variables contain information regarding the configuration 37of each network interface. 38.Nm 39is processed by 40.Pa /etc/rc.d/network 41at system boot time. 42.Pp 43For each interface 44.Pq Ar nnX 45that is to be configured, there should be either an 46.Sy ifconfig_nnX 47variable in 48.Xr rc.conf 5 , 49or an 50.Pa /etc/ifconfig.nnX 51file 52(such as the 53.Sy ifconfig_fxp0 54variable or the 55.Pa /etc/ifconfig.fxp0 56file for the 57.Sy fxp0 58interface). 59The variable or file will get evaluated only if the interface exists on 60the system. 61Multiple lines can be placed in a variable or file, and will be 62evaluated sequentially. 63In the case of a variable, semicolons may be used instead of 64newlines, as described in 65.Xr rc.conf 5 . 66.Ao backslash Ac Ns Ao newline Ac 67sequences in files are ignored, so long logical lines may be 68made up of several shorter physical lines. 69.Pp 70Normally, a line will be evaluated as command line arguments to 71.Xr ifconfig 8 . 72.Dq Li ifconfig Ar nnX 73will be prepended on evaluation. 74Arguments with embedded shell metacharacters should be quoted in 75.Xr sh 1 76style. 77.Pp 78If the line is equal to 79.Dq dhcp , 80.Xr dhcpcd 8 81will be started for the interface. 82.Pp 83If a line is empty, or starts with 84.Sq # , 85the line will be ignored as comment. 86.Pp 87If a line starts with 88.Sq \&! , 89the rest of line will get evaluated as shell script fragment. 90Shell variables declared in 91.Pa /etc/rc.d/network 92are accessible but may not be modified. 93The most useful variable is 94.Li $int , 95as it will be bound to the interface being configured with the file. 96.Pp 97For example, the following illustrates static interface configuration: 98.Bd -literal -offset indent 99# IPv4, with an alias 100inet 10.0.1.12 netmask 255.255.255.0 media 100baseTX 101inet 10.0.1.13 netmask 255.255.255.255 alias 102# let us have IPv6 address on this interface 103inet6 2001:db8::1 prefixlen 64 alias 104# have subnet router anycast address too 105inet6 2001:db8:: prefixlen 64 alias anycast 106.Ed 107.Pp 108The following illustrates dynamic configuration setup with 109.Xr dhclient 8 110and 111.Xr rtsol 8 : 112.Bd -literal -offset indent 113up 114# autoconfigure IPv4 address 115!dhclient $int 116# autoconfigure IPv6 address. Be sure to set $ip6mode to autohost. 117!rtsol $int 118.Ed 119.Pp 120The following example sets a network name for a wireless interface 121(using quotes to protect special characters in the name), 122and starts 123.Xr dhcpcd 8 : 124.Bd -literal -offset indent 125ssid 'my network' 126dhcp 127.Ed 128.Pp 129The following example is for dynamically-created pseudo interfaces like 130.Xr gif 4 . 131Earlier versions of 132.Pa /etc/rc.d/network 133required an explicit 134.Sq create 135command for such interfaces, 136but creation is now handled automatically. 137.Bd -literal -offset indent 138up 139# configure IPv6 default route toward the interface 140!route add -inet6 default ::1 141!route change -inet6 default -ifp $int 142.Ed 143.Sh FILES 144.Pa /etc/rc.d/network 145.Sh SEE ALSO 146.Xr rc.conf 5 , 147.Xr ifconfig 8 148