localhost or LAN addresses in /etc/hosts

Chris G cl at isbd.net
Tue Dec 16 15:14:11 UTC 2008


On Tue, Dec 16, 2008 at 09:11:16AM -0400, Derek Broughton wrote:
> Chris G wrote:
> 
> > On Mon, Dec 15, 2008 at 02:44:28PM -0400, Derek Broughton wrote:
> 
> >> No, that's just the ONE place you have to do things.  In the time
> >> you've been asking us how to do this with a piece of software that
> >> you had to add to your system, I could have done the setup dozens of
> >> times on a router.
> >> 
> > ... and, similarly, I could have done it by editing /etc/hosts.
> 
> If you _could_ you wouldn't have  been asking here. 
> 
> > Who says - I seem to have it working fine now using dnsmasq and simple
> > names.  I just guessed that I *could* remove the entries I was
> > originally asking about and it all works OK.  It's what dnsmasq is
> > specifically designed to do as far as I understand it.
> 
> Except  that you have now broken your /etc/hosts.  Why do you think it 
> is set up with your local host on the 127.*.*.* subnet?
> 
> > That's what my original question was about.  All I wanted to know was
> > whether I could remove the local host name from the 127.0.0.1 and
> > 127.0.1.1 entries and leave it against the 192.168.1.4 entry.  It
> > turns out that I *can* do this and everything works well with dnsmasq.
> 
> Of course you _can_ do that - but now you can't address your machine 
> except by going out over the network.

I still have the localhost entries in /etc/hosts, so I can most
certainly address my machine without going out.

As an aside it appears to be *quicker* to go out 'over the network'
than to use localhost anyway:-

    chris$ ping localhost
    PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.027 ms
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=2 ttl=64 time=0.028 ms
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=3 ttl=64 time=0.028 ms
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=4 ttl=64 time=0.028 ms
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=5 ttl=64 time=0.028 ms

    chris$ ping isbd
    PING home.isbd.net (192.168.1.4) 56(84) bytes of data.
    64 bytes from home.isbd.net (192.168.1.4): icmp_seq=1 ttl=64 time=0.025 ms
    64 bytes from home.isbd.net (192.168.1.4): icmp_seq=2 ttl=64 time=0.023 ms
    64 bytes from home.isbd.net (192.168.1.4): icmp_seq=3 ttl=64 time=0.022 ms
    64 bytes from home.isbd.net (192.168.1.4): icmp_seq=4 ttl=64 time=0.025 ms
    64 bytes from home.isbd.net (192.168.1.4): icmp_seq=5 ttl=64 time=0.024 ms
    64 bytes from home.isbd.net (192.168.1.4): icmp_seq=6 ttl=64 time=0.023 ms
    64 bytes from home.isbd.net (192.168.1.4): icmp_seq=7 ttl=64 time=0.022 ms
    64 bytes from home.isbd.net (192.168.1.4): icmp_seq=8 ttl=64 time=0.024 ms

In fact I'm not at all convinced that a connection to isbd from isbd
does really go out and back.


This is with /etc/hosts as follows:-

    127.0.0.1   localhost.localdomain   localhost

    192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net chris.isbd.net




-- 
Chris Green




More information about the ubuntu-users mailing list