1*9de06003Skim.\" $NetBSD: ifconfig.if.5,v 1.22 2020/10/11 22:46:24 kim Exp $ 23711020bSitojun.\" 33711020bSitojun.\" Copyright (c) 1996 Matthew R. Green 43711020bSitojun.\" All rights reserved. 53711020bSitojun.\" 63711020bSitojun.\" Redistribution and use in source and binary forms, with or without 73711020bSitojun.\" modification, are permitted provided that the following conditions 83711020bSitojun.\" are met: 93711020bSitojun.\" 1. Redistributions of source code must retain the above copyright 103711020bSitojun.\" notice, this list of conditions and the following disclaimer. 113711020bSitojun.\" 2. Redistributions in binary form must reproduce the above copyright 123711020bSitojun.\" notice, this list of conditions and the following disclaimer in the 133711020bSitojun.\" documentation and/or other materials provided with the distribution. 143711020bSitojun.\" 153711020bSitojun.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 163711020bSitojun.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 173711020bSitojun.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 183711020bSitojun.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 193711020bSitojun.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 203711020bSitojun.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 213711020bSitojun.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 223711020bSitojun.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 233711020bSitojun.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 243711020bSitojun.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 253711020bSitojun.\" SUCH DAMAGE. 263711020bSitojun.\" 27*9de06003Skim.Dd October 12, 2020 283711020bSitojun.Dt IFCONFIG.IF 5 293711020bSitojun.Os 303711020bSitojun.Sh NAME 313711020bSitojun.Nm ifconfig.if 3294f952dfSapb.Nd interface-specific configuration files or variables 333711020bSitojun.Sh DESCRIPTION 343711020bSitojunThe 353711020bSitojun.Nm 3694f952dfSapbfiles or variables contain information regarding the configuration 3794f952dfSapbof each network interface. 383711020bSitojun.Nm 393711020bSitojunis processed by 403711020bSitojun.Pa /etc/rc.d/network 41d5197a0bSitojunat system boot time. 423711020bSitojun.Pp 4394f952dfSapbFor each interface 4494f952dfSapb.Pq Ar nnX 4594f952dfSapbthat is to be configured, there should be either an 4694f952dfSapb.Sy ifconfig_nnX 4794f952dfSapbvariable in 4894f952dfSapb.Xr rc.conf 5 , 4994f952dfSapbor an 5094f952dfSapb.Pa /etc/ifconfig.nnX 5194f952dfSapbfile 5294f952dfSapb(such as the 5394f952dfSapb.Sy ifconfig_fxp0 5494f952dfSapbvariable or the 5594f952dfSapb.Pa /etc/ifconfig.fxp0 5694f952dfSapbfile for the 5794f952dfSapb.Sy fxp0 5894f952dfSapbinterface). 59b793e91eSjymOnly characters allowed in 60b793e91eSjym.Xr sh 1 61b793e91eSjymvariables names should be used for 62b793e91eSjym.Ar nnX 63b793e91eSjym.Po Xr ascii 7 64b793e91eSjymuppercase and lowercase letters, digits, and underscore 65b793e91eSjym.Pc . 66b793e91eSjym.Pp 6794f952dfSapbThe variable or file will get evaluated only if the interface exists on 6894f952dfSapbthe system. 6994f952dfSapbMultiple lines can be placed in a variable or file, and will be 7094f952dfSapbevaluated sequentially. 7194f952dfSapbIn the case of a variable, semicolons may be used instead of 7294f952dfSapbnewlines, as described in 7394f952dfSapb.Xr rc.conf 5 . 74cc2db4f5Sapb.Ao backslash Ac Ns Ao newline Ac 75cc2db4f5Sapbsequences in files are ignored, so long logical lines may be 76cc2db4f5Sapbmade up of several shorter physical lines. 773711020bSitojun.Pp 78d5197a0bSitojunNormally, a line will be evaluated as command line arguments to 79d5197a0bSitojun.Xr ifconfig 8 . 8094f952dfSapb.Dq Li ifconfig Ar nnX 813711020bSitojunwill be prepended on evaluation. 8294f952dfSapbArguments with embedded shell metacharacters should be quoted in 8394f952dfSapb.Xr sh 1 8494f952dfSapbstyle. 853711020bSitojun.Pp 8632455b20SjoergIf the line is equal to 8732455b20Sjoerg.Dq dhcp , 8832455b20Sjoerg.Xr dhcpcd 8 8932455b20Sjoergwill be started for the interface. 90636fc830SroyHowever, it is instead recommended that 91636fc830Sroy.Sy dhcpcd 92636fc830Sroyis set to true in 93636fc830Sroy.Xr rc.conf 5 94636fc830Sroyand any per interface configuration or restriction is done in 95636fc830Sroy.Xr dhcpcd.conf 5 . 9632455b20Sjoerg.Pp 97aae8c85bSkimIf the line is equal to 98aae8c85bSkim.Dq rtsol , 992f25d900Skima dedicated 1002f25d900Skim.Xr dhcpcd 8 1012f25d900Skimprocess will be started for processing received router advertisements 1022f25d900Skimand sending out IPv6 router solicitation messages on the interface. 103aae8c85bSkimThis is useful on networks where default routes can best be learned 104aae8c85bSkimfrom router advertisements. 105aae8c85bSkimHowever, if 106aae8c85bSkim.Sy dhcpcd 107aae8c85bSkimhas been set to true in 108aae8c85bSkim.Xr rc.conf 5 , 1092f25d900Skimit is assumed that that 110aae8c85bSkim.Xr dhcpcd 8 1112f25d900Skimprocess will take care of sending any necessary router solicitation 1122f25d900Skimmessages and processing received router advertisements on all 1132f25d900Skiminterfaces, and therefore no per-interface process is started. 114aae8c85bSkim.Pp 1153711020bSitojunIf a line is empty, or starts with 1163711020bSitojun.Sq # , 1173711020bSitojunthe line will be ignored as comment. 1183711020bSitojun.Pp 1193711020bSitojunIf a line starts with 120ced65d9aSwiz.Sq \&! , 1213711020bSitojunthe rest of line will get evaluated as shell script fragment. 1223711020bSitojunShell variables declared in 1233711020bSitojun.Pa /etc/rc.d/network 12494f952dfSapbare accessible but may not be modified. 1253711020bSitojunThe most useful variable is 1263711020bSitojun.Li $int , 1273711020bSitojunas it will be bound to the interface being configured with the file. 1283711020bSitojun.Pp 1293711020bSitojunFor example, the following illustrates static interface configuration: 130ced65d9aSwiz.Bd -literal -offset indent 1313711020bSitojun# IPv4, with an alias 1320d5dab06Swizinet 10.0.1.12 netmask 255.255.255.0 media 100baseTX 1330d5dab06Swizinet 10.0.1.13 netmask 255.255.255.255 alias 1343711020bSitojun# let us have IPv6 address on this interface 1357acb962bSrpauloinet6 2001:db8::1 prefixlen 64 alias 1363711020bSitojun# have subnet router anycast address too 1377acb962bSrpauloinet6 2001:db8:: prefixlen 64 alias anycast 1383711020bSitojun.Ed 1393711020bSitojun.Pp 140aae8c85bSkimFor networks that do not use a virtual address for the default gateway 141aae8c85bSkimthat could be set using a single address in 142aae8c85bSkim.Sy defaultroute6 , 143aae8c85bSkimstatic IPv6 address configuration could use the 144aae8c85bSkim.Dq rtsol 145aae8c85bSkimkeyword instead to solicit router advertisements for learning a default 146aae8c85bSkimroute and even achieving route redundancy given multiple responding 147aae8c85bSkimrouters: 148aae8c85bSkim.Bd -literal -offset indent 149aae8c85bSkiminet6 2001:db8::100 prefixlen 64 alias 150aae8c85bSkimrtsol 151aae8c85bSkim.Ed 152aae8c85bSkim.Pp 1530ccde41dSjakllschThe following example sets a network name for a wireless interface 1540ccde41dSjakllsch(using quotes to protect special characters in the name), 1550ccde41dSjakllschand starts 1560ccde41dSjakllsch.Xr dhcpcd 8 : 1570ccde41dSjakllsch.Bd -literal -offset indent 1580ccde41dSjakllschssid 'my network' 1590ccde41dSjakllschdhcp 1600ccde41dSjakllsch.Ed 1610ccde41dSjakllsch.Pp 1623711020bSitojunThe following example is for dynamically-created pseudo interfaces like 163a61d570bSapb.Xr gif 4 . 164a61d570bSapbEarlier versions of 165a61d570bSapb.Pa /etc/rc.d/network 166a61d570bSapbrequired an explicit 167a61d570bSapb.Sq create 168a61d570bSapbcommand for such interfaces, 169a61d570bSapbbut creation is now handled automatically. 170ced65d9aSwiz.Bd -literal -offset indent 1713711020bSitojunup 1723711020bSitojun# configure IPv6 default route toward the interface 1733711020bSitojun!route add -inet6 default ::1 1743711020bSitojun!route change -inet6 default -ifp $int 1753711020bSitojun.Ed 1763711020bSitojun.Sh FILES 1773711020bSitojun.Pa /etc/rc.d/network 1783711020bSitojun.Sh SEE ALSO 1793711020bSitojun.Xr rc.conf 5 , 1803711020bSitojun.Xr ifconfig 8 181