[BLUG] Ubuntu Speed Tweak - /etc/hosts

Simon Ruiz blug_at_mailman.cs.indiana.edu
Wed, 21 Mar 2007 15:58:52 -0400


You're saying there might be a reason to leave it as is? Drat. It's so nice, though.
 
I'm not having any issues, and can still ssh into the machines...
 
I can't find anything on launchpad about it...

________________________________

From: blug-admin_at_cs.indiana.edu on behalf of Steven Black
Sent: Wed 3/21/2007 3:10 PM
To: blug_at_cs.indiana.edu
Subject: Re: [BLUG] Ubuntu Speed Tweak - /etc/hosts



I can tell you why this works:

The default for Ubuntu is to have the hostname's IP address mapped to an
IP address on the localnet (127.x.x.x) but not to assign that address to
an interface.

Basically, this change is making any service that would normally grab
your IP address based upon your hostname grab the localhost IP address
instead.

You should be able to achieve the same result if you create an alias
setting lo:0 to 127.0.1.1.

If you use a fixed IP address mapping your machine name to the localhost
IP may cause your machine to not work as expected. (If you have services
you run on the machine they will be completely unavailable unless they
bind to every available address.)

The loopback interface is much faster than any physical interface. It's
also faster than trying to access an IP address that is undefined. This
is where the speed improvement is coming.

Personally, I used fixed IP addresses for any machine running Linux on a
fixed network. As such, my machine name is usually mapped to an address
on an eth port. (It makes it easier to SSH into the machine.)

Now it used to be that by default would be a mapping for the hostname to
the localhost IP address if you didn't specify a fixed IP address. This
was changed so presumably they had a reason for that change. I first
noticed this change with Ubuntu 6.06 (Dapper) so the Ubuntu bug database
may mention it. I do not believe this is in Debian's 'etch' distribution
(I didn't see it in the /etc/hosts file of the Debian etch system I
administer and I usually comment out those lines instead of deleting
them.)

Cheers,
Steven Black