Re: /etc/hosts + resolvconf (was Re: associating names and addresses)
On Tue, Mar 25, 2008 at 09:39:22PM -0400, Douglas A. Tutty wrote:
> On Wed, Mar 26, 2008 at 12:22:41PM +1300, Chris Bannister wrote:
> > root@box:~# apt-cache policy resolvconf
> > resolvconf:
> > Installed: (none)
> > [..]
> >
> > So thats ok? But If resolvconf is installed then /etc/hosts should be:
> >
> > 127.0.0.1 localhost.localdomain localhost
> >
> > Is that correct?
>
> The way I look at it is thus:
>
> If the box is stand-alone, not on any network, and you want to give it a
> name other than "localhost", then just do:
>
> 127.0.0.1 localhost.localdomain localhost fred
>
> with "fred" in /etc/hostname.
>
> If the box is stand-alone with dial-up ppp to the internet, just do the
> same thing.
>
> However, once you have a NIC and have an interface other than lo, then
> assign the box's hostname to that NIC, e.g:
>
> 127.0.0.1 localhost.localdomain localhost
> 192.168.0.1 fred
>
> And if there is any chance of expanding your network in the future, give
> yourself a domain name now:
> 192.168.0.1 fred.myhome fred
>
> Having the resolvconf package is primarily useful if you have various
> dynamic sources of DNS info. I.e. you have ppp, you sometimes use
> another local box or you sometimes access the internet with ethernet
> (e.g. a laptop box that travels).
>
> I haven't found any UNIX book that talks about the contents of
> /etc/hosts on a box that isn't on a network. I don's see a problem
> putting the localhost in the 127.0.0.1 line; it means that you can
>
> $ ping fred
>
> and ping the localhost. More importantly, it helps if you, e.g.
> misconfigure your MTA and it tries to do a DNS lookup before it sends
> the mail to itself, it will find itself.
>
> I hope this helps.
Yes it does. Thanks!
> If you want more definitive UNIX networking, try "UNIX System
> Administration Handbook".
Rather expensive last time I saw it. :-(
--
Chris.
======
Reply to: