set FQDN for hostname

Luis Paulo luis.barbas at gmail.com
Sun Nov 7 00:43:32 UTC 2010


On Sat, Nov 6, 2010 at 23:41, Tom H <tomh0665 at gmail.com> wrote:
> On Sat, Nov 6, 2010 at 12:58 PM, Luis Paulo <luis.barbas at gmail.com> wrote:
>> On Sat, Nov 6, 2010 at 10:29, Tom H <tomh0665 at gmail.com> wrote:
>>>
>>> Assuming
>>>
>>> cat /etc/network/interfaces
>>> auto lo
>>> iface lo inet loopback
>>> auto eth0
>>> iface eth0 inet dncp
>>>
>>> and
>>>
>>> cat /etc/hosts
>>> 127.0.0.1   localhost.localdomain   localhost
>>> 127.0.1.1   thufir.hawat   thufir
>>>
>>> If "/etc/hostname" is empty or non-existent, "hostname" and "hostname
>>> --short" will return "localhost", "hostname --long" will return
>>> "localhost.localdomain", and "hostname --domain" will return
>>> "localdomain".
>>>
>>> If "cat /etc/hostname" returns "thufir",  "hostname" and "hostname
>>> --short" will return "thufir", "hostname --long" will return
>>> "thufir.hawat", and "hostname --domain" will return "hawat".
>>>
>>> If "cat /etc/hostname" returns "thufir.hawat",  "hostname" and
>>> "hostname --long" will return "thufir.hawat", "hostname --short" will
>>> return "thufir", and "hostname --domain" will return "hawat".
>>
>> ...
>> The /etc/hostname should only contain the hostname (not the domain part)
>>...
>
> I mentioned both scenarios (short and long name in "/etc/hostname")
> because this choice is just as divisive as vi/emacs, gnome/kde,
> sendmail/postfix/exim, ... It is as much as a religious belief as it
> is a canonical way of setting up a box.
>

Oh, sorry Tom, I was more trying to complement to the OP than to
contradict you. I see what you mean.

A few years ago, I remember hostname (with -f, I guess) returning
something like desktop.example.com.example.com  (I was using a local
dns, pretty sure)
Also I was still new to linux and very new to having a local
dns/dhcpd, so I don't know if I will be able to reproduce it, but I
may try.

That's why I made a note to myself to just use the host name on
/etc/hostname. Not really sure if that was the problem, now that you
have mentioned it.

Right now, I change /etc/hostname to desktop.example.com
$ hostname --long
hostname: Name or service not know     # same thing it did with just
desktop on /etc/hostname

and
$ hostname -A
desktop.<correct dns domain>     # not example.com

I'll reboot and check again (and bind is not yet really configured
since I changed to lucid)

Thanks
Luis




More information about the ubuntu-users mailing list