.\" -*- nroff -*-
.\" macros
.de EX \" Begin Example
.  IP
.  ft CW
.  nf
.  ne \\$1
..
.de EE \" End Example
.  ft P
.  fi
.  PP
..
.TH INTERFACES 5 "5 April 2004" "ifupdown" "File formats"
.SH NAME
/etc/network/interfaces \- network interface configuration for ifup and ifdown 
.SH DESCRIPTION
/etc/network/interfaces contains network interface configuration
information for the
.BR ifup (8)
and
.BR ifdown (8)
commands.
This is where you configure how your system is connected to the network.
.P
Lines starting with `#' are ignored. Note that end-of-line comments are
NOT supported, comments must be on a line of their own.
.P
A line may be extended across multiple lines by making the last character
a backslash.
.P
The file consists of zero or more "iface", "mapping", "auto", "allow-" and
"source" stanzas. Here is an example.
.EX
auto lo eth0
allow-hotplug eth1

iface lo inet loopback

source interfaces.d/machine\-dependent

mapping eth0 
 	script /usr/local/sbin/map\-scheme
 	map HOME eth0\-home
 	map WORK eth0\-work

iface eth0\-home inet static
 	address 192.168.1.1
 	netmask 255.255.255.0
 	up flush\-mail

iface eth0\-work inet dhcp

iface eth1 inet dhcp
.EE
Lines beginning with the word "auto" are used to identify the physical
interfaces to be brought up when
.B ifup
is run with the
.B \-a
option.  (This option is used by the system boot scripts.)
Physical interface names should follow the word "auto" on the same line.
There can be multiple "auto" stanzas.
.B ifup
brings the named interfaces up in the order listed.
.P
Lines beginning with "allow-" are used to identify interfaces that should
be brought up automatically by various subsytems. This may be done using
a command such as "ifup \-\-allow=hotplug eth0 eth1", which will only bring
up eth0 or eth1 if it is listed in an "allow-hotplug" line. Note that
"allow-auto" and "auto" are synonyms.
.P
Lines beginning with "source" are used to include stanzas from other files,
so configuration can be split into many files. The word "source" is 
followed by the path of file to be sourced. Shell wildcards can be 
used.
(See
.BR wordexp (3)
for details.)
.P
Stanzas beginning with the word "mapping" are used to determine how a
logical interface name is chosen for a physical interface that is to be
brought up.  The first line of a mapping stanza consists of the word
"mapping" followed by a pattern in shell glob syntax.  Each mapping stanza
must contain a
.BR script
definition.  The named script is run with the physical interface name as
its argument and with the contents of all following "map" lines 
(\fBwithout\fR the leading "map") in the
stanza provided to it on its standard input. The script must print a
string on its standard output before exiting. See 
.IR /usr/share/doc/ifupdown/examples
for examples of what the script must print.
.P
Mapping a name consists of searching the remaining mapping
patterns and running the script corresponding to the first match;
the script outputs the name to which the original is mapped.
.P
.B ifup
is normally given a physical interface name as its first non\-option argument.
.B ifup
also uses this name as the initial logical name for the interface unless
it is accompanied by a  suffix of the form \fI=LOGICAL\fR, in which case
ifup chooses \fILOGICAL\fR as the initial logical name for the interface.
It then maps this name, possibly more than once according to successive
mapping specifications,  until no further mappings are possible.  If the
resulting name is the name of some defined logical interface then
.B ifup 
attempts to bring up the physical interface
as that logical interface.  Otherwise
.B ifup
exits with an error.
.P
Stanzas defining logical interfaces start with a line consisting of the
word "iface" followed by the name of the logical interface.
In simple configurations without mapping stanzas this name should simply
be the name of the physical interface to which it is to be applied.
(The default mapping script is, in effect, the
.B echo
command.)
The interface name is followed by the name of the address family that the
interface uses.  This will be "inet" for TCP/IP networking, but there is
also some support for IPX networking ("ipx"), and IPv6 networking ("inet6").
Following that is the name of the method used to configure the interface.
.P
Additional options can be given on subsequent lines in the stanza.
Which options are available depends on the family and method,
as described below.
Additional options can be made available by other Debian packages.
For example, the wireless\-tools package makes available a number of
options prefixed with "wireless\-" which can be used to configure the
interface using
.BR iwconfig (8) .
(See
.BR wireless (7)
for details.)
.P
Options are usually indented for clarity (as in the example above)
but are not required to be.
.SH IFACE OPTIONS
The following "command" options are available for every family and method.
Each of these options can be given multiple times in a single stanza,
in which case the commands are executed in the order in which they appear
in the stanza.
(You can ensure a command never fails by suffixing "|| true".)
.TP
.BI pre\-up " command"
Run
.I command
before bringing the interface up.
If this command fails then
.B ifup
aborts,
refraining from marking the interface as configured,
prints an error message,
and exits with status 0.
This behavior may change in the future.
.TP
.BI up " command" 
.TP
.BI post\-up " command"
Run
.I command
after bringing the interface up.
If this command fails then
.B ifup
aborts,
refraining from marking the interface as configured
(even though it has really been configured),
prints an error message,
and exits with status 0.
This behavior may change in the future.
.TP
.BI down " command"
.TP
.BI pre\-down " command"
Run
.I command
before taking the interface down.
If this command fails then
.B ifdown
aborts,
marks the interface as deconfigured
(even though it has not really been deconfigured),
and exits with status 0.
This behavior may change in the future.
.TP
.BI post\-down " command"
Run
.I command
after taking the interface down.
If this command fails then
.B ifdown
aborts,
marks the interface as deconfigured,
and exits with status 0.
This behavior may change in the future.
.P
There exists for each of the above mentioned options a directory
.IR /etc/network/if\-\fB<option>\fI.d/ 
the scripts in which are run (with no arguments) using
.BR run\-parts (8)
after the option itself has been processed. Please note that as
.BI post\-up
and
.BI pre\-down
are aliases, no files in the corresponding directories are processed.
Please use
.IR if-up.d
and
.IR if-down.d
directories instead.
.P
All of these commands have access to the following environment variables.
.TP
.B IFACE
physical name of the interface being processed
.TP
.B LOGICAL
logical name of the interface being processed
.TP
.B ADDRFAM
address family of the interface
.TP
.B METHOD
method of the interface (e.g.,
.IR static )
.TP
.B MODE
.IR start " if run from ifup, " stop " if run from ifdown"
.TP
.B PHASE 
as per MODE, but with finer granularity, distinguishing the
\fIpre-up\fR, \fIpost-up\fR, \fIpre-down\fR and \fIpost-down\fR phases.
.TP
.B VERBOSITY
indicates whether \fB\-\-verbose\fR was used; set to 1 if so, 0 if not.
.TP
.B PATH
the command search path:
.I /usr/local/sbin:\%/usr/local/bin:\%/usr/sbin:\%/usr/bin:\%/sbin:\%/bin
.P
Additionally, all options given in an interface definition stanza are
exported to the environment in upper case with "IF_" prepended and with
hyphens converted to underscores and non\-alphanumeric characters discarded.
.SH INET ADDRESS FAMILY
This section documents the methods available in the
inet address family.
.SS The loopback Method
This method may be used to define the IPv4 loopback interface. 
.PP
.B Options
.RS
.TP
(No options)
.RE
.SS The static Method
This method may be used to define ethernet interfaces with statically allocated IPv4 addresses. 
.PP
.B Options
.RS
.TP
.BI address " address            "
Address (dotted quad/netmask) \fBrequired\fP
.TP
.BI netmask " mask               "
Netmask (dotted quad or CIDR)
.TP
.BI broadcast " broadcast_address"
Broadcast address (dotted quad, + or -) Default value: +
.TP
.BI metric " metric              "
Routing metric for default gateway (integer)
.TP
.BI gateway " address            "
Default gateway (dotted quad)
.TP
.BI pointopoint " address        "
Address of other end point (dotted quad). Note the spelling of "point-to".
.TP
.BI hwaddress " address          "
Link local address.
.TP
.BI mtu " size                   "
MTU size
.TP
.BI scope
Address validity scope. Possible values: global, link, host
.RE
.SS The manual Method
This method may be used to define interfaces for which no configuration is done by default. Such interfaces can be configured manually by means of \fBup\fP and \fBdown\fP commands or /etc/network/if-*.d scripts. 
.PP
.B Options
.RS
.TP
.BI hwaddress " address     "
Hardware address
.TP
.BI mtu " size              "
MTU size
.RE
.SS The dhcp Method
This method may be used to obtain an address via DHCP with any of the tools: dhclient, pump, udhcpc, dhcpcd. (They have been listed in their order of precedence.) If you have a complicated DHCP setup you should note that some of these clients use their own configuration files and do not obtain their configuration information via \fBifup\fP. 
.PP
.B Options
.RS
.TP
.BI hostname " hostname      "
Hostname to be requested (pump, dhcpcd, udhcpc)
.TP
.BI leasehours " leasehours  "
Preferred lease time in hours (pump)
.TP
.BI leasetime " leasetime    "
Preferred lease time in seconds (dhcpcd)
.TP
.BI vendor " vendor          "
Vendor class identifier (dhcpcd)
.TP
.BI client " client          "
Client identifier (dhcpcd, udhcpc)
.TP
.BI hwaddress " address      "
Hardware Address.
.RE
.SS The bootp Method
This method may be used to obtain an address via bootp. 
.PP
.B Options
.RS
.TP
.BI bootfile " file "
Tell the server to use \fIfile\fP as the bootfile.
.TP
.BI server " address"
Use the IP address \fIaddress\fP to communicate with the server.
.TP
.BI hwaddr " addr   "
Use \fIaddr\fP as the hardware address instead of whatever it really is.
.RE
.SS The tunnel Method
This method is used to create GRE or IPIP tunnels. You need to have the \fBip\fP binary from the \fBiproute\fP package. For GRE tunnels, you will need to load the ip_gre module and the ipip module for IPIP tunnels. 
.PP
.B Options
.RS
.TP
.BI address " address      "
Local address (dotted quad) \fBrequired\fP
.TP
.BI mode " type            "
Tunnel type (either GRE or IPIP) \fBrequired\fP
.TP
.BI endpoint " address     "
Address of other tunnel endpoint \fBrequired\fP
.TP
.BI dstaddr " address      "
Remote address (remote address inside tunnel)
.TP
.BI local " address        "
Address of the local endpoint
.TP
.BI gateway " address      "
Default gateway
.TP
.BI ttl " time             "
TTL setting
.TP
.BI mtu " size             "
MTU size
.RE
.SS The ppp Method
This method uses pon/poff to configure a PPP interface. See those commands for details. 
.PP
.B Options
.RS
.TP
.BI provider " name "
Use \fIname\fP as the provider (from /etc/ppp/peers).
.TP
.BI unit " number   "
Use \fInumber\fP as the ppp unit number.
.TP
.BI options " string"
Pass \fIstring\fP as additional options to pon.
.RE
.SS The wvdial Method
This method uses wvdial to configure a PPP interface. See that command for more details. 
.PP
.B Options
.RS
.TP
.BI provider " name "
Use \fIname\fP as the provider (from /etc/wvdial.conf).
.RE
.SS The ipv4ll Method
This method uses avahi-autoipd to configure an interface with an IPv4 Link-Layer address (169.254.0.0/16 family). This method is also known as APIPA or IPAC, and often colloquially referred to as "Zeroconf address". 
.PP
.B Options
.RS
.TP
(No options)
.RE
.SH IPX ADDRESS FAMILY
This section documents the methods available in the
ipx address family.
.SS The static Method
This method may be used to setup an IPX interface. It requires the \fIipx_interface\fP command. 
.PP
.B Options
.RS
.TP
.BI frame " type            "
\fItype\fP of ethernet frames to use (e.g. \fB802.2\fP)
.TP
.BI netnum " id             "
Network number
.RE
.SS The dynamic Method
This method may be used to setup an IPX interface dynamically. 
.PP
.B Options
.RS
.TP
.BI frame " type            "
\fItype\fP of ethernet frames to use (e.g. \fB802.2\fP)
.RE
.SH INET6 ADDRESS FAMILY
This section documents the methods available in the
inet6 address family.
.SS The auto Method
This method may be used to define interfaces with automatically assigned IPv6 addresses. Using this method on its own doesn't mean that RDNSS options will be applied, too. To make this happen, \fBrdnssd\fP daemon must be installed, properly configured and running. If stateless DHCPv6 support is turned on, then additional network configuration parameters such as DNS and NTP servers will be retrieved from a DHCP server. 
.PP
.B Options
.RS
.TP
.BI privext " int           "
Privacy extensions (RFC3041) (0=off, 1=assign, 2=prefer)
.TP
.BI dhcp " int              "
Use stateless DHCPv6 (0=off, 1=on)
.RE
.SS The loopback Method
This method may be used to define the IPv6 loopback interface. 
.PP
.B Options
.RS
.TP
(No options)
.RE
.SS The static Method
This method may be used to define interfaces with statically assigned IPv6 addresses. By default, stateless autoconfiguration is disabled for this interface. 
.PP
.B Options
.RS
.TP
.BI address " address       "
Address (colon delimited) \fBrequired\fP
.TP
.BI netmask " mask          "
Netmask (number of bits, eg 64) \fBrequired\fP
.TP
.BI gateway " address       "
Default gateway (colon delimited)
.TP
.BI media " type            "
Medium type, driver dependent
.TP
.BI hwaddress " address     "
Hardware address
.TP
.BI mtu " size              "
MTU size
.TP
.BI accept_ra " int         "
Accept router advertisements (0=off, 1=on)
.TP
.BI autoconf " int          "
Perform stateless autoconfiguration (0=off, 1=on)
.TP
.BI privext " int           "
Privacy extensions (RFC3041) (0=off, 1=assign, 2=prefer)
.TP
.BI scope
Address validity scope. Possible values: global, site, link, host
.RE
.SS The manual Method
This method may be used to define interfaces for which no configuration is done by default. Such interfaces can be configured manually by means of \fBup\fP and \fBdown\fP commands or /etc/network/if-*.d scripts. 
.PP
.B Options
.RS
.TP
.BI hwaddress " address          "
Link local address.
.TP
.BI mtu " size                   "
MTU size
.RE
.SS The dhcp Method
This method may be used to obtain network interface configuration via stateful DHCPv6 with dhclient. In stateful DHCPv6, the DHCP server is responsible for assigning addresses to clients. 
.PP
.B Options
.RS
.TP
.BI hwaddress " address     "
Hardware address
.RE
.SS The v4tunnel Method
This method may be used to setup an IPv6-over-IPv4 tunnel. It requires the \fBip\fP command from the \fBiproute\fP package. 
.PP
.B Options
.RS
.TP
.BI address " address      "
Address (colon delimited)
.TP
.BI netmask " mask         "
Netmask (number of bits, eg 64)
.TP
.BI endpoint " address     "
Address of other tunnel endpoint (IPv4 dotted quad) \fBrequired\fP
.TP
.BI local " address        "
Address of the local endpoint (IPv4 dotted quad)
.TP
.BI gateway " address      "
Default gateway (colon delimited)
.TP
.BI ttl " time             "
TTL setting
.TP
.BI mtu " size             "
MTU size
.RE
.SS The 6to4 Method
This method may be used to setup an 6to4 tunnel. It requires the \fBip\fP command from the \fBiproute\fP package. 
.PP
.B Options
.RS
.TP
.BI local " address        "
Address of the local endpoint (IPv4 dotted quad) \fBrequired\fP
.TP
.BI ttl " time             "
TTL setting
.TP
.BI mtu " size             "
MTU size
.RE
.SH CAN ADDRESS FAMILY
This section documents the methods available in the
can address family.
.SS The static Method
This method may be used to setup an Controller Area Network (CAN) interface. It requires the the \fBip\fP command from the \fBiproute\fP package. 
.PP
.B Options
.RS
.TP
.BI bitrate " bitrate	"
bitrate (1..1000000) \fBrequired\fP
.TP
.BI samplepoint " samplepoint"
sample point (0.000..0.999)
.TP
.BI loopback " loopback	"
loop back CAN Messages (on|off)
.TP
.BI listenonly " listenonly"
listen only mode (on|off)
.TP
.BI triple " triple	"
activate triple sampling (on|off)
.TP
.BI oneshot " oneshot	"
one shot mode (on|off)
.TP
.BI berr " berr		"
activate berr reporting (on|off)
.RE
.SH KNOWN BUGS/LIMITATIONS
The
.B ifup
and
.B ifdown
programs work with so-called "physical" interface names.
These names are assigned to hardware by the kernel.
Unfortunately it can happen that the kernel assigns different
physical interface names to the same hardware at different
times; for example, what was called "eth0" last time you booted
is now called "eth1" and vice versa.
This creates a problem if you want to configure the interfaces
appropriately.
A way to deal with this problem is to use mapping scripts that
choose logical interface names according to the properties of
the interface hardware.
See the
.B get-mac-address.sh
script in the examples directory for an example of such a mapping
script.  See also Debian bug #101728.
.SH AUTHOR
The ifupdown suite was written by Anthony Towns <aj@azure.humbug.org.au>.
This manpage was contributed by Joey Hess <joey@kitenet.net>.
.SH "SEE ALSO"
.BR ifup (8),
.BR ip (8),
.BR ifconfig (8),
.BR run\-parts (8).
.P
For advice on configuring this package read the
.B Network Configuration
chapter of the \fIDebian Reference\fR manual,
available at
\fIhttp://www.debian.org/doc/manuals/debian-reference/ch05.en.html\fR
or in the \fBdebian-reference-en\fR package.
.P
Examples of how to set up interfaces can be found in
.BR /usr/share/doc/ifupdown/examples/network-interfaces.gz .
