]>
Commit | Line | Data |
---|---|---|
e37ad4a6 | 1 | ========== |
2 | interfaces | |
3 | ========== | |
4 | ||
5 | -------------------------------------------- | |
6 | network interface configuration for ifupdown | |
7 | -------------------------------------------- | |
8 | ||
9 | :Author: roopa@cumulusnetworks.com | |
10 | :Date: 2014-02-05 | |
11 | :Copyright: Copyright 2014 Cumulus Networks, Inc. All rights reserved. | |
12 | :Version: 0.1 | |
13 | :Manual section: 5 | |
14 | ||
15 | DESCRIPTION | |
16 | =========== | |
d40e96ee | 17 | **/etc/network/interfaces** contains network interface configuration |
18 | information for the **ifup(8)**, **ifdown(8)** and **ifquery(8)** commands. | |
e37ad4a6 | 19 | |
20 | This is where you configure how your system is connected to the network. | |
21 | ||
22 | Lines starting with # are ignored. Note that end-of-line comments are | |
23 | NOT supported, comments must be on a line of their own. | |
24 | ||
25 | A line may be extended across multiple lines by making the last character | |
26 | a backslash. | |
27 | ||
28 | The file consists of zero or more "iface", "auto", "allow-" | |
d40e96ee | 29 | and "source" stanzas. Here is an example:: |
e37ad4a6 | 30 | |
d40e96ee | 31 | auto lo eth0 |
32 | allow-hotplug eth1 | |
e37ad4a6 | 33 | |
d40e96ee | 34 | iface lo inet loopback |
e37ad4a6 | 35 | |
d40e96ee | 36 | source /etc/network/interfaces.d/machine-dependent |
e37ad4a6 | 37 | |
d40e96ee | 38 | iface eth0-home inet static |
39 | address 192.168.1.1/24 | |
40 | up flush-mail | |
e37ad4a6 | 41 | |
d40e96ee | 42 | iface eth0-work inet dhcp |
43 | ||
44 | iface eth1 inet dhcp | |
e37ad4a6 | 45 | |
46 | Lines beginning with the word "auto" are used to identify the physical | |
47 | interfaces to be brought up when ifup is run with the -a option. | |
48 | (This option is used by the system boot scripts.) Physical interface names | |
49 | should follow the word "auto" on the same line. There can be multiple | |
50 | "auto" stanzas. | |
51 | ||
52 | Lines beginning with "allow-" are used to identify interfaces that | |
53 | should be brought up automatically by various subsytems. This may be | |
54 | done using a command such as "ifup --allow=hotplug eth0 eth1", which | |
55 | will only bring up eth0 or eth1 if it is listed in an "allow-hotplug" | |
56 | line. Note that "allow-auto" and "auto" are synonyms. | |
57 | ||
58 | Lines beginning with "source" are used to include stanzas from other | |
59 | files, so configuration can be split into many files. The word "source" | |
60 | is followed by the path of file to be sourced. Shell wildcards can be | |
61 | used. (See wordexp(3) for details.). Currently only supports absolute | |
62 | path names. | |
63 | ||
64 | ifup is normally given a physical interface name as its first non-option | |
65 | argument. | |
66 | ||
67 | The interface name is followed by the name of the address family that the | |
68 | interface uses. This will be "inet" for TCP/IP networking and inet6 for | |
69 | ipv6. Following that is the name of the method used to configure the | |
70 | interface. | |
71 | ||
72 | ifupdown2 supports iface stanzas without a family or a method. This enables | |
73 | using the same stanza for inet and inet6 family addresses. | |
74 | ||
75 | Interface options can be given on subsequent lines in the iface stanza. | |
76 | These options come from addon modules. see interfaces-addons(5) for | |
77 | these options. | |
78 | ||
83c1f241 | 79 | ifupdown2 supports python-mako style templates in the interfaces file. |
80 | See examples section for details. | |
81 | ||
e37ad4a6 | 82 | METHODS |
83 | ======= | |
84 | Both inet and inet6 address family interfaces can use the following | |
85 | methods (However they are not required): | |
86 | ||
87 | The loopback Method | |
88 | This method may be used to define the loopback interface. | |
89 | ||
90 | The static Method | |
91 | This method may be used to define ethernet interfaces with | |
92 | statically allocated addresses. | |
93 | ||
94 | The dhcp Method | |
95 | This method may be used to obtain an address via DHCP. | |
96 | ||
97 | BUILTIN INTERFACES | |
98 | ================== | |
99 | iface sections for some interfaces like physical interfaces or vlan | |
100 | interfaces in dot notation (like eth1.100) are understood by ifupdown2. | |
101 | These kind of interfaces do not need an entry in the interfaces file. | |
102 | However, if these interfaces need extra configuration like addresses, they | |
103 | will need to be specified. | |
104 | ||
105 | EXAMPLES | |
106 | ======== | |
d40e96ee | 107 | Sample /etc/network/interfaces file:: |
e37ad4a6 | 108 | |
d40e96ee | 109 | auto lo |
110 | iface lo | |
111 | address 192.168.2.0/24 | |
112 | address 2001:dee:eeee:1::4/128 | |
e37ad4a6 | 113 | |
d40e96ee | 114 | auto eth0 |
115 | iface eth0 inet dhcp | |
e37ad4a6 | 116 | |
d40e96ee | 117 | auto eth1 |
118 | iface eth1 inet manual | |
119 | address 192.168.2.0/24 | |
120 | address 2001:dee:eeee:1::4/128 | |
e37ad4a6 | 121 | |
d40e96ee | 122 | # source files from a directory /etc/network/interfaces.d |
123 | source /etc/network/interfaces.d/* | |
e37ad4a6 | 124 | |
d40e96ee | 125 | # Using mako style templates |
126 | % for v in [11,12]: | |
127 | auto vlan${v} | |
128 | iface vlan${v} inet static | |
129 | address 10.20.${v}.3/24 | |
130 | % endfor | |
e37ad4a6 | 131 | |
d40e96ee | 132 | For additional syntax and examples see **ifupdownaddons-interfaces(5)** |
e37ad4a6 | 133 | |
134 | FILES | |
135 | ===== | |
136 | /etc/network/interfaces | |
137 | ||
138 | SEE ALSO | |
139 | ======== | |
d40e96ee | 140 | ifupdownaddons-interfaces(5), |
141 | ifup(8), | |
142 | ifquery(8), | |
e37ad4a6 | 143 | ifreload(8) |