a /etc/rc.d/network at system boot time.
p For each interface
q Ar nnX that is to be configured, there should be either an .Sy ifconfig_nnX variable in .Xr rc.conf 5 , or an
a /etc/ifconfig.nnX file (such as the .Sy ifconfig_fxp0 variable or the
a /etc/ifconfig.fxp0 file for the .Sy fxp0 interface). Only characters allowed in .Xr sh 1 variables names should be used for .Ar nnX
o Xr ascii 7 uppercase and lowercase letters, digits, and underscore
c .
p The variable or file will get evaluated only if the interface exists on the system. Multiple lines can be placed in a variable or file, and will be evaluated sequentially. In the case of a variable, semicolons may be used instead of newlines, as described in .Xr rc.conf 5 . .Ao backslash Ac Ns Ao newline Ac sequences in files are ignored, so long logical lines may be made up of several shorter physical lines.
p Normally, a line will be evaluated as command line arguments to .Xr ifconfig 8 . .Dq Li ifconfig Ar nnX will be prepended on evaluation. Arguments with embedded shell metacharacters should be quoted in .Xr sh 1 style.
p If the line is equal to .Dq dhcp , .Xr dhcpcd 8 will be started for the interface.
p If a line is empty, or starts with .Sq # , the line will be ignored as comment.
p If a line starts with .Sq ! , the rest of line will get evaluated as shell script fragment. Shell variables declared in
a /etc/rc.d/network are accessible but may not be modified. The most useful variable is .Li $int , as it will be bound to the interface being configured with the file.
p For example, the following illustrates static interface configuration: d -literal -offset indent # IPv4, with an alias inet 10.0.1.12 netmask 255.255.255.0 media 100baseTX inet 10.0.1.13 netmask 255.255.255.255 alias # let us have IPv6 address on this interface inet6 2001:db8::1 prefixlen 64 alias # have subnet router anycast address too inet6 2001:db8:: prefixlen 64 alias anycast .Ed
p The following illustrates dynamic configuration setup with .Xr dhclient 8 and .Xr rtsol 8 : d -literal -offset indent up # autoconfigure IPv4 address !dhclient $int # autoconfigure IPv6 address. Be sure to set $ip6mode to autohost. !rtsol $int .Ed
p The following example sets a network name for a wireless interface (using quotes to protect special characters in the name), and starts .Xr dhcpcd 8 : d -literal -offset indent ssid 'my network' dhcp .Ed
p The following example is for dynamically-created pseudo interfaces like .Xr gif 4 . Earlier versions of
a /etc/rc.d/network required an explicit .Sq create command for such interfaces, but creation is now handled automatically. d -literal -offset indent up # configure IPv6 default route toward the interface !route add -inet6 default ::1 !route change -inet6 default -ifp $int .Ed .Sh FILES
a /etc/rc.d/network .Sh SEE ALSO .Xr rc.conf 5 , .Xr ifconfig 8