[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: hosts file entry for 127.0.1.1



Philippe Clérié wrote:
> Brian wrote:
> >Philippe Clérié wrote:
> > > It tends to be annoying when using dnsmasq as a server for static hosts.
> >
> > You'll have to be more specific.
> 
> Nothing major. Just that every so often when trying to reach a host being
> used as a DNS server with dnsmasq, I get hit with that address.

Why?  As far as I can see that should never happen.

> It's just an annoyance and I was trying to understand the purpose of
> that assignment.
> 
> I've read through some of that thread you pointed to and to be honest, it's
> not at all clear what problem was being solved. I'm still not entirely
> convinced it's useful. But it's easily dealt with so... :-)

On a network server it isn't really useful.  A network server will
always have at least one network connection.  The network will always
be up and online.  If the server only has one IP address then people
get slack and start to assume that every machine has exactly one IP
address and every IP address as a reverse DNS back to that one
hostname in a one to one correspondence.  That tended to be the
classic legacy Unix programming model.  It isn't true in the general
case however and multi-homed hosts break those assumptions.  Just
because people did it, a lot, doesn't make it right.

A mobile device such as a laptop or tablet is, well, mobile.  People
take them everywhere.  They are always getting different addresses
from DHCP.  There isn't any interconnection between dhcp and
/etc/hosts.  You could write a hook script though so that every time
an IP address comes in through dhcp then it could update the
/etc/hosts file.

On a desktop it could go either way.  Does the desktop have DHCP?  If
so then the IP address assigned could vary from time to time.  But of
course you can always assign a static IP address to your home desktop
too and then it looks more like a server.

Think also of the mobile device.  When offline between networks then
the network device is offline.  Let's say you were trying to use a VM
on a laptop while on a train or airplane disconnected from any
network.  In that case if it required an IP address then you wouldn't
be able to communicate.  By using 127.0.1.1 on the lo loopback device
then the problem of an offline network is avoided.  The lo device is
never offline.  The lo loopback device is always available for local
traffic and using 127.0.1.1 enables local communication regardless of
the state of the external network.

Bob

P.S.  That type of dynamic update is what Dynamic DNS is trying to do
with the networked DNS data.  MS-Windows hosts always try to do a
Dynamic DNS update after getting an IP address and ignore the error
when they can't.  Most of the time you can't such as when operating at
a coffee shop, airport, hotel, and so forth.

Attachment: signature.asc
Description: Digital signature


Reply to: