IFCONFIG.IF(5)
π ifconfig.if(5) β the File Formats Manual page for interface-specific config files & vars π
π NAME π
ifconfig.if β interface-specific configuration files or variables. Periodt. π«Ά
β¨ DESCRIPTION β¨
Okay so the ifconfig.if files (or variables!) hold the info for configuring each network interface. ifconfig.if is processed by /etc/rc.d/network at system boot time. Iconic. π
For each interface (nnX) that is to be configured, there should be either an ifconfig_nnX variable in rc.conf(5), or an /etc/ifconfig.nnX file β like the ifconfig_fxp0 variable or the /etc/ifconfig.fxp0 file for the fxp0 interface. Only characters allowed in sh(1) variables names should be used for nnX (ascii(7) uppercase and lowercase letters, digits, and underscore). No cap. β¨
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 rc.conf(5). β¨backslashβ©β¨newlineβ© sequences in files are ignored, so long logical lines may be made up of several shorter physical lines. Slay for readability. πΈ
Normally, a line will be evaluated as command line arguments to ifconfig(8). βifconfig nnXβ will be prepended on evaluation. Arguments with embedded shell metacharacters should be quoted in sh(1) style. Highkey important. π₯
Now the special line vibes:
- If the line is equal to β
dhcpβ,dhcpcd(8)will be started for the interface. However, it is instead recommended thatdhcpcdis set totrueinrc.conf(5)and any per interface configuration or restriction is done indhcpcd.conf(5). - If the line is equal to β
rtsolβ, a dedicateddhcpcd(8)process will be started for processing received router advertisements and sending out IPv6 router solicitation messages on the interface. This is useful on networks where default routes can best be learned from router advertisements. However, ifdhcpcdhas been set totrueinrc.conf(5), it is assumed that thatdhcpcd(8)process will take care of sending any necessary router solicitation messages and processing received router advertisements on all interfaces, and therefore no per-interface process is started. - If a line is empty, or starts with β
#β, the line will be ignored as comment. Bye bestie π - If a line starts with β
!β, the rest of line will get evaluated as shell script fragment. Shell variables declared in/etc/rc.d/networkare accessible but may not be modified. The most useful variable is$int, as it will be bound to the interface being configured with the file.
For example, the following illustrates static interface configuration:
# 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
For networks that do not use a virtual address for the default gateway that could be set using a single address in defaultroute6, static IPv6 address configuration could use the βrtsolβ keyword instead to solicit router advertisements for learning a default route and even achieving route redundancy given multiple responding routers:
inet6 2001:db8::100 prefixlen 64 alias
rtsol
The following example sets a network name for a wireless interface (using quotes to protect special characters in the name), and starts dhcpcd(8):
ssid 'my network'
dhcp
The following example is for dynamically-created pseudo interfaces like gif(4). Earlier versions of /etc/rc.d/network required an explicit βcreateβ command for such interfaces, but creation is now handled automatically.
up
# configure IPv6 default route toward the interface
!route add -inet6 default ::1
!route change -inet6 default -ifp $int
π FILES π
/etc/rc.d/network
π SEE ALSO π
Source/version and date vibes, bestie: Debian Β· October 12, 2020 Β· IFCONFIG.IF(5). Mwah π
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 1996 Matthew R. Green
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms