localhost or LAN addresses in /etc/hosts

Chris G cl at isbd.net
Sat Dec 13 10:42:05 UTC 2008


On Sat, Dec 13, 2008 at 02:04:42AM +0100, Florian Diesch wrote:
> Chris G <cl at isbd.net> wrote:
> 
> > How does one decide whether to put a machine's name as a localhost
> > address or an actual LAN address in /etc/hosts?
> 
> 
> 
> 
> 
> > My ubuntu server machine's name is isbd, this appears in three places
> > in /etc/hosts at the moment:-
> >
> >     127.0.0.1   isbd    localhost.localdomain   localhost
> >     127.0.1.1 isbd
> >
> >     192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net chris.isbd.net
> 
> Having multiple IP addresses for one name in /etc/hosts is usually a bad idea.
> 
> 
> > I think the 127.0.1.1 is redundant and should be removed, can I also
> > remove the isbd from the 127.0.0.1 line as well?  
> 
> Think about what you want 'isbd' to resolve to. 
> 
> Usually you want to have a FQDN for a name, too, so most likely the
> 127.0.1.1 isn't what you want.
> 
The issue is that *I* didn't put the 127.0.0.1 or 127.0.1.1 entries in
/etc/hosts, the ubuntu installation process put them there.  The
machine "isbd" is set up with a static IP of 192.168.1.4 and I added
that entry.

What I'm asking is whether removing the 127.0.0.1 and 127.0.1.1
entries for isbd will break anything.  If I can remove those entries
without any problems then dnsmasq will do what I want and tell the
rest of my LAN that "isbd" is 192.168.1.4.

-- 
Chris Green




More information about the ubuntu-users mailing list