This file associates host names with IP addresses. It resolves or looks up, an IP address when the hostname is known. The first column contains the IP address. The second column is the fully qualified hostnames. 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 ifup attempts to bring up the physical interface as that logical interface.
Otherwise 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. 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. See wireless 7 for details. Options are usually indented for clarity as in the example above but are not required to be. For example, interface eth0. 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 them with " true". If this command fails then 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. If this command fails then 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.
Where auto starts the interface at boot and iface calls the network interface in this case lo, loopback. If instead of configuring the interface with DHCP you want to set a static IP address and gateway replace the previous instructions with the following replace Defining gateway and broadcast is optional.
Could you address the function of the gateway parameter in the interfaces file? What effect does it have and how I can I measure this? If you had for example eth0 on When the link state for one of those interfaces changes from down to up the listed gateway would then also become the default gateway.
In practice this is what happens if you have a wireless card that connects to the internet on one network and a wired that connects to the internet on a different network. The gateway used is from the up interfaces definitions. Joe Joe 1, 6 6 silver badges 16 16 bronze badges.
From the manual man interfaces : gateway address Default gateway dotted quad So, gateway is used to specify a default route, not a static route. Christopher Christopher Thank you very much for this explanation and for the link which I will read through shortly. This was definitely informative.
But my question was asking about the effect of the "gateway" parameter in the interfaces file. It doesn't seem to be having any effect. What does it do? It specifies the default gateway, the first hop out on the default route. But it doesn't actually do that - the "post-up" command is setting the gateway and the "gateway" parameter has no effect.
That's sort of the point of my question. Apparently I haven't phrased my question clearly, because it seems that no one is answering it in the way I would have expected.
DHCP acquires the default gateway without your having to specify it.
0コメント