Mailinglist Archive: opensuse (1239 mails)

< Previous Next >
Re: [opensuse] Why does yast use for localhost?
On 10 Jun 2013, at 16:10, James Knott wrote:

Carlos E. R. wrote:
localhost is in hosts, twice at least.

There's no problem with having more than one line with a host name.
Only the first one will be used.

That is not routinely true. Assuming a typical nsswitch.conf, both the traditional gethostbyname() and the modern getaddrinfo() calls that resolve names to addresses both return structures that include all addresses whose entries in /etc/hosts include the name as a value or all values provided by normal DNS resolution of the name, with no particular significance to the ordering of the addresses returned. If (as when setting Postfix's "inet_interfaces" parameter to a list of hostnames) a daemon's configuration tells it to listen on particular addresses by hostname, it is only rational for that daemon to see that as a directive to use all of the addresses to which the name resolves.

That's why this is a problem for Postfix: it is being told to open listeners using a name that resolves to 2 addresses: one that is bound to a configured network interface and, which isn't. A quirk of the Linux loopback implementation allows listeners to be opened on any address in 127/8 on the lo interface, but Postfix doesn't (and shouldn't) handle 127/8 specially and open listeners on arbitrary addresses that just happen to work. It sees that isn't configured on any interface, reports its misconfiguration, and dies because that sort of error is severe for a MTA.

That you can ping that destination is not the same as pinging /from/
that IP.

How often do you ever ping from an IP?

Not very frequently, but apparently far more often than you would expect. :)

The best you can do is specify
which interface is to be used.

That does not accurately describe the functionality of the "-I" option to the modern Linux (iputils) version of ping nor of the analogous options in the BSD (-b/-S) and SVr4/Solaris (-i) ping implementations. All 3 of those provide for the specification of a source address OR an interface name.

The actual address used is the one
that's assigned to the interface that is used to reach the destination.

It is common for interfaces to have many more than one IP address assigned to them, so "the one that's assigned to the interface" may be a meaningless phrase. More precisely: a target address uses a particular route which is bound to an interface and may use a specific source address. If you do not specify a source address for ping to use, it will use the source address specific to the route (if their is one) or the default address for the interface to which the route is bound.

To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups