|HOSTNAME.IF(5)||File Formats Manual||HOSTNAME.IF(5)|
interface-specific configuration files
hostname.* files contain information
regarding the configuration of each network interface. One file should exist
for each interface that is to be configured, such as
hostname.bridge0. A configuration file is not needed
The configuration information is expressed in a line-by-line packed format which makes the most common cases simpler; those dense formats are described below. Any lines not matching these packed formats are passed directly to ifconfig(8). The packed formats are converted using a somewhat inflexible parser and the administrator should not expect magic — if in doubt study ifconfig(8) and the per-driver manual pages to see what arguments are permitted.
Arguments containing either whitespace or single quote characters must be double quoted. For example:
inet 10.0.0.1 255.255.255.0 10.0.0.255 description "Bob's uplink"
Each line is processed separately and in order. For example:
join mynwid wpakey mywpakey inet6 autoconf inet autoconf
would run ifconfig three times to add a wireless network using WPA to the join list and enable dynamic address configuration for IPv6 and IPv4.
The following packed formats are valid for configuring network interfaces with static addresses.
Regular IPv4 network setup:
alias] addr netmask broadcast_addr options
Regular IPv6 network setup:
alias] addr prefixlen options
Other network setup:
A typical file contains only one line, but more extensive files are possible, for example:
media 100baseTX description Uplink inet 10.0.1.12 255.255.255.0 10.0.1.255 inet alias 10.0.1.13 255.255.255.255 10.0.1.13 inet alias 10.0.1.14 255.255.255.255 NONE inet alias 10.0.1.15 255.255.255.255 inet alias 10.0.1.16 0xffffffff # This is an example comment line. inet6 alias fec0::1 64 inet6 alias fec0::2 64 anycast !route add 184.108.40.206 10.0.1.13 up
The above formats have the following field values:
If no address is specified, the netmask,
dest_addr options are invalid and will be
For example, to set 192.0.2.1 and 2001:db8::1 as source IP addresses for outgoing connections:
inet 192.0.2.1/32 inet6 2001:db8::1/128 up !route sourceaddr -ifp \$if
IPv4 dynamic addressing via DHCP is requested using “inet autoconf” followed by any options to be passed to ifconfig(8).
The token “dhcp” on its own line without any options is short for “inet autoconf”.
IPv6 stateless address autoconfiguration is requested using the literal string “inet6 autoconf” followed by any options to be passed to ifconfig(8).
The autoconf configurations will communicate learned DNS information to resolvd(8).
If the network interface is a bridge, the options described in the bridge section of the ifconfig(8) manual page apply.
add fxp0 add ep1 -learn fxp0 # !ipsecctl -F # static fxp0 8:0:20:1e:2f:2b up # and finally enable it
|November 11, 2021||OpenBSD-current|