[Nix-dev] [NixOS] 127.0.0.1 in /etc/hosts

Rickard Nilsson rickard.nilsson at telia.com
Sun Oct 7 20:18:27 CEST 2012


Hi,

Den 2012-10-07 06:24:02 skrev Eelco Dolstra <eelco.dolstra at logicblox.com>:

> Hi,
>
> On 05/10/12 13:11, Rickard Nilsson wrote:
>
>> Is there some particular motivation behind the /etc/hosts generation?  
>> Why
>> should the hostname always be mapped to 127.0.0.1? I think it is wrong,
>> simply.
>
> The reason is that some software assumes that the hostname resolves to a  
> valid
> IP address.  However, a better solution is to use nss-myhostname [1],  
> which I'm
> currently testing.  It makes the hostname resolve to the IP addresses of  
> your
> network interfaces, or ::1 / 127.0.0.2 as a fallback.
>
> [1] http://0pointer.de/lennart/projects/nss-myhostname/

nss-myhostname sounds like a good idea. I just wonder what happens when  
you have several network links configured, and want your hostname to  
resolve to one of those IPs. The documentation for nss-myhostname says  
"nss-myhostname simply returns all locally configure public IP addresses".  
I'm not sure what would happen in the nfsd case, would rpc-nfsd bind to  
all local IPs (which would basically be the same as 0.0.0.0), or would it  
pick the first one returned by nss-myhostname?

   / Rickard


More information about the nix-dev mailing list