Huh.  

It's not April 1 yet.  So this can't be an April Fools Joke.

There's a file out there called /etc/nsswitch.conf which regulates
the order in which services are queried.  (in fact it regulates the
behavior of the gethostbyname() function)

In my default ubuntu config this says for hostname lookups, go to files
and then to DNS.

That's the purpose of this line:

        hosts:          files dns

So it goes to look up "tvsfrank.mst3k" in /etc/hosts and it sees this:

        127.0.1.1 tvsfrank.mst3k

And 127.0.1.1 is already covered by the loopback interface.

Then if I ping 127.0.1.1, I get this:

[EMAIL PROTECTED]:~$ ping 127.0.1.1
PING 127.0.1.1 (127.0.1.1) 56(84) bytes of data.
64 bytes from 127.0.1.1: icmp_seq=1 ttl=64 time=0.035 ms

So tvsfrank.mst3k is answering it's own pings through the loopback
interface.  And that makes sense.  So 127.0.1.1 is effectively the same
as 127.0.0.1.

So it doesn't appear to be a gehostbyname() problem.  Okay is it an
issue with X?

Every GUI that pops up in Linux is reliant on the DISPLAY variable being
set.  Normally it's set to the value ":0.0".

So...

[EMAIL PROTECTED]:~$ xhost
access control enabled, only authorized clients can connect
[EMAIL PROTECTED]:~$ xauth list
tvsfrank/unix:0  MIT-MAGIC-COOKIE-1  c35a6585ceb64c8283de556499817645
localhost.localdomain/unix:0  MIT-MAGIC-COOKIE-1
c35a6585ceb64c8283de556497645

Huh.  Unix domain sockets.  But doesn't X have port 6000 open on UDP?

[EMAIL PROTECTED]:~$ sudo lsof | grep 6000
[EMAIL PROTECTED]:~$ 

Hmm.  Apparently not. 

So let's check my $DISPLAY variable to make sure it's set the way I
think it is.

[EMAIL PROTECTED]:~$ echo $DISPLAY
:0.0


So I guess what I'm saying is that I fail to see how it makes any
difference.  You can't get to :0.0 without a unix domain socket, and the
unix domain sockets don't rely on /etc/hosts.

So that brings us to the question why is the hostname assigned the
127.0.1.1 address?

Here's the answer: 

http://lists.debian.org/debian-boot/2005/06/msg01047.html

http://lists.debian.org/debian-boot/2005/06/msg00938.html


--R



On Wed, 2007-03-21 at 22:46 -0400, Karl wrote:
> That's all good and well until you use applications that need to know
> ips other than 127.0.0.1 for your hostname. 
> 
> Your tip is bad practice and can break applications. I can't count the
> number of times this has been the root of problems that were perceived
> to be much larger. 
> 
> The only reason this "works" is because 127.0.0.1 is resolved through
> memory, and as such, the computer doesn't have to send out a packet
> over the network only to come right back to itself. If your boost is
> "significant", then you need to fix your networking, as slow responses
> over your 127.0.1.x network would indicate your networking is
> slow/poor. That said, you do have a full network in the 127.0.1.x
> range correct?
> 
> Trust me, this is a *bad* thing.
> 
> Regards,
> Karl Abbott
> 
> On 3/21/07, Simon Ruiz <[EMAIL PROTECTED]> wrote:
>         For those of you using Ubuntu, though likely not applicable
>         ONLY those using Ubuntu, this little tweak gives your
>         application load time a HUGE boost--that is, it makes
>         application load times noticeably shorter.
>         
>         <disclaimer>I have no idea why this works</disclaimer> 
>         
>                 Edit your "/etc/hosts" file:
>                 $ sudo gedit /etc/hosts
>         
>                 You should see something like this:
>         
>                 127.0.0.1 localhost
>                 127.0.1.1 martin-laptop
>                 (and if your in Feisty, some lines about IPV6
>         
>                 Now, add the following:
>         
>                 127.0.0.1 localhost martin-laptop
>                 127.0.1.1 martin-laptop
>                 (Replace "martin-laptop" with your hostname)
>         
>                 Save. Should work instantly, or sometimes on reboot.
>         
>         Read at Martin Albisetti's blog
>         <http://beuno.com.ar/?p=4>  (via the Ubuntu Planet RSS feed).
>         
>         To be perfectly honest, I didn't even notice I was taking a
>         performance hit because the sorts of load times I got before
>         this tweak were comparable to load times I've been used to
>         expecting on Windows for a long time. 
>         
>         Hope this finds you all doing great!
>         
>         Simón
>         
>         
>         _______________________________________________
>         Fwlug mailing list
>         Fwlug@fortwaynelug.org
>         http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org
> 
> _______________________________________________
> Fwlug mailing list
> Fwlug@fortwaynelug.org
> http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org



_______________________________________________
Fwlug mailing list
Fwlug@fortwaynelug.org
http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org

Reply via email to