INTERFACES(5) File formats INTERFACES(5)
NAME
/etc/network/interfaces - network interface configuration
for ifup and ifdown
DESCRIPTION
/etc/network/interfaces contains network interface config-
uration information for the ifup(8) and ifdown(8) com-
mands. This is where you configure how your system is con-
nected to the network, by setting IP addresses, and other
related information.
The file can contain comments; all lines starting with `#'
are ignored. A line may be extended across multiple lines
by making the last character a \ in the usual manner.
The file consists of zero or more "iface", "mapping" and
"auto" stanzas, each of which defines one network inter-
face. Here are some sample stanzas:
auto lo eth0
iface lo inet loopback
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
iface eth0-work inet dhcp
Stanzas beginning with the word "auto" are used to iden-
tify interfaces that should be brought up automatically on
system boot. Interface names should follow the word "auto"
on the same line. Multiple "auto" stanzas may be used, or
they may be combined into a single line.
Stanzas beginning with the word "mapping" are used to
automatically translate a physical interface name into a
logical interface specified by an "iface" stanza. The
first line of a mapping stanza begins with the word "map-
ping" followed by the names of each physical interface
this mapping should apply to. Shell globs (* and ? wild-
cards) may be used when specifying interfaces. Each map-
ping must specify a script, which will be run when the
mapping is applied. In addition, a mapping may specify any
number of "map" parameters that will be passed to the
script.
Stanzas defining interfaces start with the word "iface".
The next word is the name of the interface, as used by the
ifconfig(8) or route(8) commands (ie, things like "lo",
"eth0", or "ppp0", and "eth1:0").
The interface name is followed by address family the
interface uses -- generally this will be "inet" for TCP/IP
networking, but there is also some support for IPX net-
working ("ipx"), and IPv6 networking ("inet6").
Following that is the method used to configure the inter-
face. In the example above, this is "static", which means
that eth0 is a staticly allocated IPv4 address.
Further options may follow the "iface" header line on
additional lines in the stanza. These are usually indented
for clarity (as in the example) but are not required to
be.
IFACE OPTIONS
There are currently four standard options available for
all interfaces, regardless of address family or method.
These are:
up command
Run command after bringing the interface up. This
option can be given multiple times for a single
interface. If so, the commands will be executed in
order. If one of the commands fails, none of the
others will be executed, but the interface will
remain configured. (You can ensure a command never
fails by suffixing "|| true".)
pre-up command
Run command before bringing the interface up. This
option can be given multiple times for a single
interface. If so, the commands will be executed in
order. If one of the commands fails, none of the
others will be executed, and the interface will not
be configured. (You can ensure a command never
fails by suffixing "|| true".)
down command
Run command before taking the interface down. This
option can be given multiple times for a single
interface. If so, the commands will be executed in
order. If one of the commands fails, none of the
others will be executed, and the interface will not
be deconfigured. (You can ensure a command never
fails by suffixing "|| true".)
post-down command
Run command after taking the interface down. This
option can be given multiple times for a single
interface. If so, the commands will be executed in
order. If one of the commands fails, none of the
others will be executed, but the interface will
remain deconfigured. (You can ensure a command
never fails by suffixing "|| true".)
Most methods require additional information, such as
address, and netmask; details about the available methods
and the information they require are given below.
Furthermore there exists for each of the above mentioned
options an associated directory /etc/net-
work/if-