Hostname configuration on DHCP/DNS server: /etc/hosts vs. /etc/hostname

Tom H tomh0665 at gmail.com
Sun Mar 27 20:15:44 UTC 2011


On Sun, Mar 27, 2011 at 2:23 PM, Chris G <cl at isbd.net> wrote:
> On Sun, Mar 27, 2011 at 10:11:52AM -0400, Tom H wrote:
>> On Sun, Mar 27, 2011 at 9:49 AM, Chris G <cl at isbd.net> wrote:
>> > On Sun, Mar 27, 2011 at 02:56:48PM +0200, Niki Kovacs wrote:
>> >>
>> >> I have a DHCP/DNS server (Ubuntu 10.04) running on my local network.
>> >> The domain name is the dummy "presbytere.montpezat" for all the
>> >> local machines. Of course the server has a static network
>> >> configuration in /etc/network/interfaces.
>> >>
>> >> Here's how /etc/hosts is configured:
>> >>
>> >> 127.0.0.1 localhost.localdomain localhost
>> >> 192.168.1.2 proliant.presbytere.montpezat proliant
>> >>
>> >> Now I wonder what I should put in /etc/hostname. I think it should
>> >> only be this:
>> >>
>> >> proliant
>> >>
>> >> But now I wonder if I should put the FQDN in it, like this :
>> >>
>> >> proliant.presbytere.montpezat
>> >>
>> >> If I remember correctly, that's how my Red Hat servers were
>> >> configured. Anybody knows the "right" (or at least the orthodox) way
>> >> to do this?
>> >>
>> > I have a small home network with a local DNS/DHCP server too (it uses
>> > dnsmasq).   All systems except the DNS server itself have just the
>> > following:-
>> >
>> >    /etc/hosts
>> >
>> >        127.0.0.1       localhost
>> >
>> >    /etc/hostname
>> >
>> >        chris
>> >
>> > (of course you change the hostname 'chris' according to the host's name!)
>> >
>> > If you add all that localhost.localdomain stuff and the IP line then
>> > things beging to break, in particular both apache2 and leafnode complain
>> > that they can't find a FQDN for the host.
>>
>> Please don't spread FUD!
>>
> I'm spreading *simplicity*!  :-)  My /etc/hosts is simpler!
>
>> I don't know about leafnode but apache2 doesn't break if you have
>> "127.0.0.1 localhost.localdomain localhost" in "/etc/hosts".
>>
>> You have to ensure that your box is set up with either "127.0.1.1
>> myhost.mydomain myhost" for a dhcp box or "my_fixed_ip_address
>> myhost.mydomain myhost" in "/etc/hosts".
>>
> Why add all that complexity?

The way that you create your "/etc/hosts" is simpler (I also use
"127.0.0.1 localhost") but that doesn't mean that setting up
"/etc/hosts" as Debian and Ubuntu set it up by default breaks apache2!




More information about the ubuntu-users mailing list