[Nix-dev] Adding hostnames to 127.0.0.1 in /etc/hosts

4levels 4levels at gmail.com
Tue Mar 1 13:10:53 CET 2016


Dear Nix'ers,

I've been wondering how all my deployed machines with NixOps, get this
default hosts file layout (where [hostname] is the actual server's
hostname):

127.0.0.1 localhost
::1 localhost
127.0.0.1 [hostname]-encrypted

I was recently pointed to the fact that an IP address should only be
present once in the hosts file as lookups happen in both directions (name
-> ip and ip -> name).  Is this resulting hostfile invalid in any way or
can I safely ignore this?

I've searched the repo's and this seems to be done in
nixops/deployment.py:426, as follows:

hosts[m.name]["127.0.0.1"].append(m.name + "-encrypted")

The reason I'm asking is that I need to add more names to the 127.0.0.1
line, but I can't seem to do this on the first line (right after localhost)
so I need to add another line starting with 127.0.0.1 to achieve this.
This results in the hosts file now containing 3 separate lines starting
with 127.0.0.1, listing different names on each line..

I never ran into issues with hosts files containing the same IP address
multiple times, so I'm just wondering how important this is since I'm
having multiple local processes (node, guzzle) performing requests to the
local machine for proxy purposes.


Kind regards,

Erik aka 4levels
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160301/91699efe/attachment.html 


More information about the nix-dev mailing list