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

Tom H tomh0665 at gmail.com
Mon Mar 28 08:27:09 UTC 2011


On Sun, Mar 27, 2011 at 4:30 PM, Chris G <cl at isbd.net> wrote:
> On Sun, Mar 27, 2011 at 04:15:44PM -0400, Tom H wrote:
>> On Sun, Mar 27, 2011 at 2:23 PM, Chris G <cl at isbd.net> wrote:
>> >> 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!
>
> Well when Network Manager came along (when I upgraded from 10.04 to
> 10.10) and changed my /etc/hosts from my simple version to the version
> with localhost.localdomain etc. in it *I* certainly got error messages
> from both apache2 and leafnode complaining that they couldn't determine
> the FQDN.
>
> When I changed it back and un-installed Network Manager the error
> messages went away.

Using NM on a server doesn't make sense unless and until nmcli and
nm-tool are installable separately from the GUI stuff...

If NM's running on 10.10, apache'll work with (ignoring ipv6 lines)

cat /etc/hostname
mybox.mydomain

cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
127.0.1.1 mybox.mydomain mybox

At boot, NM'll add the following line:
dhcp_ip_address mybox.mydomain mybox # Added by NM




More information about the ubuntu-users mailing list