1.\" $NetBSD: ifconfig.if.5,v 1.10 2008/05/29 15:38:35 joerg 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 May 27, 2008 28.Dt IFCONFIG.IF 5 29.Os 30.Sh NAME 31.Nm ifconfig.if 32.Nd interface-specific configuration files 33.Sh DESCRIPTION 34The 35.Nm 36files contain information regarding the configuration of each network interface. 37.Nm 38is processed by 39.Pa /etc/rc.d/network 40at system boot time. 41.Pp 42One file should exist for each interface that is to be configured, such as 43.Pa /etc/ifconfig.fxp0 . 44The file will get evaluated only if the interface exists on the system. 45Multiple lines can be placed in a file, and will be evaluated sequentially. 46.Pp 47Normally, a line will be evaluated as command line arguments to 48.Xr ifconfig 8 . 49.Dq Li ifconfig if 50will be prepended on evaluation. 51.Pp 52If the line is equal to 53.Dq dhcp , 54.Xr dhcpcd 8 55will be started for the interface. 56.Pp 57If a line is empty, or starts with 58.Sq # , 59the line will be ignored as comment. 60.Pp 61If a line starts with 62.Sq \&! , 63the rest of line will get evaluated as shell script fragment. 64Shell variables declared in 65.Pa /etc/rc.d/network 66are accessible. 67The most useful variable is 68.Li $int , 69as it will be bound to the interface being configured with the file. 70.Pp 71For example, the following illustrates static interface configuration: 72.Bd -literal -offset indent 73# IPv4, with an alias 74inet 10.0.1.12 netmask 255.255.255.0 media 100baseTX 75inet 10.0.1.13 netmask 255.255.255.255 alias 76# let us have IPv6 address on this interface 77inet6 2001:db8::1 prefixlen 64 alias 78# have subnet router anycast address too 79inet6 2001:db8:: prefixlen 64 alias anycast 80.Ed 81.Pp 82The following illustrates dynamic configuration setup with 83.Xr dhclient 8 84and 85.Xr rtsol 8 : 86.Bd -literal -offset indent 87up 88# autoconfigure IPv4 address 89!dhclient $int 90# autoconfigure IPv6 address. Be sure to set $ip6mode to autohost. 91!rtsol $int 92.Ed 93.Pp 94The following example is for dynamically-created pseudo interfaces like 95.Xr gif 4 : 96.Bd -literal -offset indent 97up 98# configure IPv6 default route toward the interface 99!route add -inet6 default ::1 100!route change -inet6 default -ifp $int 101.Ed 102.Pp 103Earlier versions of 104.Pa /etc/rc.d/network 105required an explicit 106.Sq create 107command for such interfaces. 108This is now handled automatically. 109.Sh FILES 110.Pa /etc/rc.d/network 111.Sh SEE ALSO 112.Xr rc.conf 5 , 113.Xr ifconfig 8 114