Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
HOSTNAME.IF(5)		  FreeBSD File Formats Manual		HOSTNAME.IF(5)

NAME
     hostname.if -- interface-specific configuration files

DESCRIPTION
     The 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.fxp0 or	hostname.bridge0.  A configu-
     ration file is not	needed for lo0.

     The configuration information is expressed	in a line-by-line packed for-
     mat 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	some-
     what 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:

	   nwid	mynwid wpakey mywpakey
	   inet6 autoconf
	   dhcp

     would run ifconfig	to set the nwid	and wpakey of the interface, run it
     again to set the AUTOCONF6	flag, and then start dhclient(8).

STATIC ADDRESS CONFIGURATION
     The following packed formats are valid for	configuring network interfaces
     with static addresses.

     Regular IPv4 network setup:

	   inet	[alias]	addr netmask broadcast_addr options
	   dest	dest_addr

     Regular IPv6 network setup:

	   inet6 [alias] addr prefixlen	options
	   dest	dest_addr

     Other network setup:

	   addr_family options

     A typical file contains only one line, but	more extensive files are pos-
     sible, 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 65.65.65.65 10.0.1.13
      up

     The above formats have the	following field	values:

	   addr_family
		   The address family of the interface,	generally "inet" or
		   "inet6".

	   alias   The literal string "alias" if this is an additional network
		   address for the interface.

	   addr	   The optional	address	that belongs to	the interface, such as
		   190.191.192.1 or fe80:2::1.	It is also feasible to use a
		   hostname as specified in /etc/hosts.	 It is recommended
		   that	an address be used instead of symbolic information,
		   since the latter might activate resolver library routines.

		   If no address is specified, the netmask, broadcast_addr,
		   dest, and dest_addr options are invalid and will be ig-
		   nored.

	   netmask
		   The optional	network	mask for the interface,	e.g.,
		   255.255.255.0.  If addr is specified	but netmask is not,
		   the classful	mask based on addr is used.

	   broadcast_addr
		   The optional	broadcast address for the interface, e.g.,
		   190.191.192.255.  The word "NONE" can also be specified in
		   order to configure the broadcast address based on the
		   netmask.  The netmask option	must be	present	in order to
		   use this option.

	   options
		   Miscellaneous options to set	on the interface, e.g.,	"media
		   100baseTX mediaopt full-duplex".  Valid options for a par-
		   ticular interface type can be found in ifconfig(8).	When
		   used, the netmask and broadcast_addr	options	must also be
		   present.

	   dest	   If the interface needs a destination	address	set, this is
		   the literal text "dest".  As	shown in the example, this
		   declaration should start on a separate line.

	   dest_addr
		   The destination address to be set on	the interface, such as
		   190.191.192.2.  It is also feasible to use a	hostname as
		   specified in	/etc/hosts.  It	is recommended that an address
		   be used instead of symbolic information which might acti-
		   vate	resolver library routines.

	   prefixlen
		   The prefixlen number, or number of bits in the netmask, to
		   be set on the interface, such as 64.

	   #	   Comments are	allowed.  Anything following a comment charac-
		   ter is treated as a comment.

	   !command
		   Arbitrary shell commands can	be executed using this direc-
		   tive, as long as they are available in the single-user en-
		   vironment (for instance, /bin or /sbin).  Useful for	doing
		   interface-specific configuration such as setting up custom
		   routes or default source IP address using route(8) or es-
		   tablishing tunnels using ifconfig(8).  It is	worth noting
		   that	"\$if" in a command line will be replaced by the in-
		   terface name.

		   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

DYNAMIC	ADDRESS	CONFIGURATION
     IPv4 dynamic addressing using DHCP	can be done in two forms:

     The token "dhcp" followed first by	dhclient(8) options and	then by
     ifconfig(8) options, which	are handled before starting dhclient(8).

	   dhcp	[dhclient_options] [ifconfig_options]

     Alternatively, the	literal	string "inet autoconf" followed	by any options
     to	be passed to ifconfig(8).

	   inet	autoconf [ifconfig_options]

     IPv6 stateless address autoconfiguration is requested using the literal
     string "inet6 autoconf" followed by any options to	be passed to
     ifconfig(8).

	   inet6 autoconf [ifconfig_options]

     The autoconf configurations will communicate learned DNS information to
     resolvd(8).

BRIDGE INTERFACE CONFIGURATION
     If	the network interface is a bridge, the options described in the	bridge
     section of	the ifconfig(8)	manual page apply.

     For example:

	   add fxp0
	   add ep1
	   -learn fxp0
	   #
	   !ipsecctl -F
	   #
	   static fxp0 8:0:20:1e:2f:2b
	   up	 # and finally enable it

FILES
     /etc/hostname.XXX	   Interface-specific configuration files.

SEE ALSO
     dhclient.conf(5), hosts(5), dhclient(8), ifconfig(8), netstart(8),	rc(8),
     slaacd(8)

FreeBSD	13.0			March 10, 2021			  FreeBSD 13.0

NAME | DESCRIPTION | STATIC ADDRESS CONFIGURATION | DYNAMIC ADDRESS CONFIGURATION | BRIDGE INTERFACE CONFIGURATION | FILES | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=hostname.if&sektion=5&manpath=OpenBSD+6.9>

home | help