/etc/network/interfaces - network interface configuration for ifup and ifdown
/etc/network/interfaces contains network interface configuration information for the ifup(8) and ifdown(8) commands. This is where you configure how your system is connected to the network.
Lines starting with `#' are ignored. A line may be extended across multiple lines by making the last character a backslash.
The file consists of zero or more "iface", "mapping" and "auto" stanzas. Here is an example.
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 up flush-mail
iface eth0-work inet dhcp
Stanzas beginning with the word "auto" are used to identify the physical interfaces to be brought up when ifup is run with the -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. ifup brings the named interfaces up in the order listed.
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 script definition. The named script is run with the physical interface name as its argument and with the contents of all following "map" lines in the stanza provided to it on its standard input. The script must print a string on its standard output before exiting.
Mapping a name consists of searching the mapping patterns and running the script corresponding to the first match; the script outputs the name to which the original is mapped.
ifup is normally given a physical interface name as its first non-option argument. ifup begins by choosing this as the logical name for the interface. It then maps this name repeatedly until either some mapping results in a logical interface name that has been defined, in which case ifup attempts to bring up the physical interface as that logical interface, or the name matches no pattern, in which case ifup exits with an error.
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 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.
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 iwconfig(8)?.
Options are usually indented for clarity (as in the example above) but are not required to be.
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. If one of the commands fails, none of the others will be executed but the interface will still be configured. (You can ensure a command never fails by suffixing "|| true".)
up command
Run command after bringing the interface up.
pre-up command
Run command before bringing the interface up.
down command
Run command before taking the interface down.
post-down command
Run command after taking the interface down.
There exists for each of the above mentioned options a directory /etc/network/if-<option>___ the scripts in which are run (with no arguments) using run-parts(8) after the option itself has been processed.
All of these commands have access to the following environment variables.
IFACE physical name of the interface being processed
ADDRFAM
address family of the interface
METHOD method of the interface (e.g., "static")
MODE either start or stop, depending on whether the script is called
by ifup or ifdown.
PATH the command search path: /usr/local/sbin:/usr/local/bin: /usr/sbin:/usr/bin:/sbin:/bin
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.
INET ADDRESS FAMILY This section documents the methods available in the inet address family.
The loopback Method
This method may be used to define the IPv4 loopback interface.
Options
(No options)
The static Method
This method may be used to define ethernet interfaces with statically allocated IPv4 addresses.
Options
address address
Address (dotted quad) required
netmask netmask
Netmask (dotted quad) required
broadcast broadcast_address
Broadcast address (dotted quad)
network network_address
Network address (dotted quad) required for 2.0.x kernels
gateway address
Default gateway (dotted quad)
pointopoint address
Address of other end point (dotted quad). Note the spelling of "point-to".
media type
Medium type, driver dependent
hwaddress class address
Hardware Address. class is one of ether, ax25, ARCnet or netrom. address is dependent on the above choice.
mtu size
MTU size
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 up and down commands or /etc/network/if-*.d scripts.
Options
(No options)
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 ifup.
Options
hostname hostname
Hostname to be requested (pump, dhcpcd, udhcpc)
leasehours leastime
Preferred lease time in hours (pump)
leasetime leasetime
Preferred lease time in seconds (dhcpcd)
vendor vendor
Vendor class identifier (dhcpcd)
client client_id
Client identifier (dhcpcd, udhcpc)
The bootp Method
This method may be used to obtain an address via bootp.
Options
bootfile file
Tell the server to use file as the bootfile.
server address
Use the IP address address to communicate with the server.
hwaddr addr
Use addr as the hardware address instead of whatever it really is.
The ppp Method
This method uses pon/poff to configure a PPP interface. See those commands for details.
Options
provider name
Use name as the provider (from /etc/ppp/peers).
The wvdial Method
This method uses wvdial to configure a PPP interface. See that command for ore details.
Options
provider name
Use name as the provider (from /etc/ppp/peers).
IPX ADDRESS FAMILY This section documents the methods available in the ipx address family.
The static Method
This method may be used to setup an IPX interface. It requires the ipx_interface command.
Options
frame type
type of ethernet frames to use (e.g. 802.2)
netnum id
Network number
The dynamic Method
This method may be used to setup an IPX interface dynamically.
Options
frame type
type of ethernet frames to use (e.g. 802.2)
INET6 ADDRESS FAMILY This section documents the methods available in the inet6 address family.
The loopback Method
This method may be used to define the IPv6 loopback interface.
Options
(No options)
The static Method
This method may be used to define interfaces with statically assigned IPv6 addresses.
Options
address address
Address (colon delimited) required
netmask mask
Netmask (number of bits, eg 64) required
gateway address
Default gateway (colon delimited)
media type
Medium type, driver dependent
hwaddress class address
Hardware Address. class is one of ether, ax25, ARCnet or netrom. address is dependent on this choice.
mtu size
MTU size
The v4tunnel Method
This method may be used to setup an IPv6-over-IPv4 tunnel. It requires the ip command from the iproute package.
Options
address address
Address (colon delimited) required
netmask mask
Netmask (number of bits, eg 64) required
endpoint address
Address of other tunnel endpoint (IPv4 dotted quad) required
local address
Address of the local endpoint (IPv4 dotted quad)
gateway address
Default gateway (colon delimited)
ttl time
TTL setting
The ifupdown suite was written by Anthony Towns <aj@azure.humbug.org.au>. This manpage was contributed by Joey Hess <joey@kitenet.net>.
ifup(8), iwconfig(8)?, run-parts(8).
the old text - can be deleted if not needed any longer -- 2003-12-30 RolfSchumacher
/etc/network/interfaces - network interface configuration for ifup and ifdown
/etc/network/interfaces contains network interface configuration information for the ifup(8) and ifdown(8) commands. This is where you configure how your system is connected 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
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
Stanzas beginning with the word
Stanzas defining interfaces start with the word ifconfig__(8)? or route(8) commands (ie, things like __
The interface name is followed by address family the interface uses -- generally this will be
Following that is the method used to configure the interface. In the example above, this is
Further options may follow the
There are currently three 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 ''
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 ''
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 ''
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 ''
Most methods require additional information, such as address, and netmask; details about the available methods and the information they require follows.
This section documents the methods available in the inet address family.
The loopback Method
This method may be used to define the IPv4 loopback interface.
Options
(No options)
The static Method
This method may be used to define ethernet interfaces with statically allocated IPv4 addresses.
Options
address address
Address (dotted quad) required
netmask netmask
Netmask (dotted quad) required
broadcast broadcast_address
Broadcast address (dotted quad)
network network_address
Network address (dotted quad) required for 2.0.x kernels
gateway address
Default gateway (dotted quad)
pointopoint address
Address of other end point (dotted quad). Note the spelling of
The dhcp Method
This method may be used to obtain an address via DHCP with any of the tools: dhclient, pump (2.2.x kernels only), or dhcpcd. If you have a complicated DHCP setup you should note that some of these clients use their own configuration files, rather than obtaining their configuration via ifup.
Options
hostname hostname
Hostname to be requested (pump, dhcpcd)
leasehours leastime
Preferred lease time in hours (pump)
leasetime leasetime
Preferred lease time in seconds (dhcpcd)
vendor vendor
Vendor class identifier (dhcpcd)
client client_id
Client identifier (dhcpcd)
The bootp Method
This method may be used to obtain an address via bootp.
Options
bootfile file
Tell the server to use file as the bootfile.
server address
Use the IP address address to communicate with the server.
hwaddr addr
Use addr as the hardware address instead of whatever it really is.
The ppp Method
This method uses pon/poff to configure a PPP interface. See those commands for details.
Options
provider name
Use name as the provider (from /etc/ppp/peers).
The wvdial Method
This method uses wvdial to configure a PPP interface. See that command for ore details.
Options
provider name
Use name as the provider (from /etc/ppp/peers).
This section documents the methods available in the ipx address family.
The static Method
This method may be used to setup an IPX interface.
Options
frame
netnum
The dynamic Method
This method may be used to setup an IPX interface dynamically.
Options
frame
This section documents the methods available in the inet6 address family.
The loopback Method
This method may be used to define the IPv6 loopback interface.
Options
(No options)
The static Method
This method may be used to define interfaces with statically assigned IPv6 addresses.
Options
address address
Address (colon delimited) required
netmask mask
Netmask (number of bits, eg 64) required
gateway address
Default gateway (colon delimited)
The v4tunnel Method
This method may be used to setup an IPv6-over-IPv4 tunnel. It requires the ip command from the iproute package.
Options
address address
Address (colon delimited) required
netmask mask
Netmask (number of bits, eg 64) required
endpoint address
Address of other tunnel endpoint (IPv4 dotted quad) required
gateway address
Default gateway (colon delimited)
The ifupdown suite was written by Anthony Towns
3 pages link to interfaces(5):