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

4levels 4levels at gmail.com
Tue Mar 1 13:31:16 CET 2016


Hi,

thank you for your swift reply!
This morning I stumbled upon this post on the unix stackexchange (from 2
years ago):
http://unix.stackexchange.com/questions/102660/hosts-file-is-it-incorrect-to-have-the-same-ip-address-on-multiple-lines

Like I said, I've been using the same ip address on multiple lines since a
long time (mostly for readability and to easily comment & uncomment lines)
on my local machines for a long time without running into issues.  I just
wanted to make sure this is quite trivial and should never cause any issues.
I'm also making sure that the names itself only appear once in the whole
file..

Kind regards,



On Tue, Mar 1, 2016 at 1:21 PM zimbatm <zimbatm at zimbatm.com> wrote:

> I don't know why [hostname]-encrypted exists but having multiple lines
> with the same address is fine. You can also have multiple names on the same
> like like:
>
> 127.0.0.1 node guzzle
>
>
> On Tue, 1 Mar 2016 at 12:11 4levels <4levels at gmail.com> wrote:
>
>> 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
>>
> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160301/355eb152/attachment.html 


More information about the nix-dev mailing list