[Dnsmasq-discuss] Questions about /etc/hosts

Chris Green cl at isbd.net
Fri Feb 11 08:49:25 UTC 2022


On Fri, Feb 11, 2022 at 12:24:27AM +0100, Petr Menšík wrote:
> I think we would need to know, which distribution and version you are
> running. /etc/hosts is not directly controlled by dnsmasq. It is often
> updated by system installation, which varies across distributions.
> 
They're a mix of [x]ubuntu and Raspberry Pi systems, however the
/etc/hosts have evolved with my changes added and removed over the
years so they're a long way from default now.


> Depends on how t470 and t470.zbmc.eu names are used any by what
> services. I would recommend --local=/zbmc.eu/ or better auth-zone=zbmc.eu.
> 
> I doubt host 127.0.1.1 were added automatically. Unless you don't know
> what does use it, I would recommend to comment it out and reboot. Unless
> you see any visible failures or delays during boot, it is safe to be
> removed :)
> 
I *think* I probably added the 127.0.1.1 so that t470 can 'talk to
itself' by name as well as by using localhost.

> Cheers,
> Petr
> 
> On 2/10/22 20:24, Chris Green wrote:
> > When running dnsmasq it (by default) uses /etc/hosts to provide some
> > system's addresses.
> >
> > Some of my systems have their names in the /etc/hosts file against
> > a loopback address so host t470 has:-
> >
> >     127.0.0.1   localhost
> >     127.0.1.1   t470.zbmc.eu t470
> >
> >
> > While others only have their names against their (static) IP address
> > so host backup has:-
> >
> >     192.168.1.1     2860n                   # Draytek router, internet
> >     192.168.1.2     dns.zbmc.eu dns         # this Pi running dnsmasq
> >     192.168.1.3     esprimo zbmc.eu         # my desktop system
> >     192.168.1.4     backup.zbmc.eu backup   # backup Raspberry Pi, also DNS/DHCP backup
> >
> >
> > Is that 127.0.1.1 loopback address just so that there is an IP for a
> > system to refer to itself (particularly in the case where it has DHCP
> > assigned IP so there isn't a fixed address for itself)?
> >
> >
> > Where a system has a static/fixed IP is it OK to have only the
> > 'localhost' loopback address and the 'real' static IP for 'self'?
> > E.g. can one have:-
> >
> >     127.0.0.1   localhost
> >
> >     192.168.1.1     2860n                   # Draytek router, internet
> >     192.168.1.2     dns.zbmc.eu dns         # this Pi running dnsmasq
> >     192.168.1.3     esprimo zbmc.eu         # my desktop system
> >     192.168.1.4     backup.zbmc.eu backup   # backup Raspberry Pi, also DNS/DHCP backup
> >
> > As the /etc/hosts file on all of those systems (which have static IP)?
> >
> -- 
> Petr Menšík
> Software Engineer
> Red Hat, http://www.redhat.com/
> email: pemensik at redhat.com
> PGP: DFCF908DB7C87E8E529925BC4931CA5B6C9FC5CB
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

-- 
Chris Green



More information about the Dnsmasq-discuss mailing list