127.0.1.1 in /etc/hosts, why?

Derek Broughton news at pointerstop.ca
Fri Aug 10 13:15:07 UTC 2007


Gerald Dachs wrote:

> Quoting Casey Stamper <casey.stamper at gmail.com>:
> 
>> I will admit my ignorance as to why that entry is in there but I DO
>> know that if you add mycomputer.mydomain mycomputer to the first line
>> as well, your name resolution speed increases and DNS lookups are much
>> faster.
> 
> Yes, I have read this too when I searched for a reason for this 127.0.1.1
> IP. This makes it even more questionable. Is this a bug?
> I have seen this only in Ubuntu and I have seen many Linux and Unix
> installations.

Is which a bug?  If domain name resolution is really slowed, I'd think
that's a bug. Using 127.0.1.1 is not a bug.  It can be quite handy to use
different IPs for different ways to name the local machine, and 127.* is
always the local machine. I really don't see how using multiple 127
addresses should slow down my name resolution.

My /etc/hosts has:

$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 othello.pointerstop.ca othello
127.0.0.2 unix
127.0.0.3 plonevdc

127.0.1.1 is my real host
127.0.0.2 is to work around a bug in NX (may not even still be present) that
tried to use Unix sockets over TCP - so if you define "unix" as your
current system, you can get a TCP socket to it.
127.0.0.3 ensures that a test HTTP server has a unique IP address.

Strictly, they could all be on 127.0.0.1, and the HTTP server can be
identified as a virtual host by Apache, but I find this convenient and
cost-free.
-- 
derek





More information about the ubuntu-users mailing list