set FQDN for hostname
Tom H
tomh0665 at gmail.com
Sat Nov 6 10:29:46 UTC 2010
On Fri, Nov 5, 2010 at 7:39 PM, Thufir Hawat <hawat.thufir at gmail.com> wrote:
>
> As best as I can tell, you must edit two files (at least on Ubuntu) to
> change the hostname result:
>
> thufir at tleilax:~$
> thufir at tleilax:~$ nl /etc/hosts
> 1 127.0.0.1 localhost.localdomain localhost
> 2 127.0.1.1 tleilax.servebeer.com tleilax
> 3 127.0.1.1 arrakis.vs.shawcable.net arrakis
>
>
> 4 # The following lines are desirable for IPv6 capable hosts
> 5 ::1 localhost ip6-localhost ip6-loopback
> 6 fe00::0 ip6-localnet
> 7 ff00::0 ip6-mcastprefix
> 8 ff02::1 ip6-allnodes
> 9 ff02::2 ip6-allrouters
> thufir at tleilax:~$
> thufir at tleilax:~$ nl /etc/hostname
> 1 tleilax
> thufir at tleilax:~$
> thufir at tleilax:~$ hostname
> tleilax
> thufir at tleilax:~$
>
>
> if /etc/hostname still references the old value, then the old value will
> still show up. It seems to screw things up if /etc/hostname doesn't
> point to anything at all.
>
> Not sure how this relates to:
>
> http://www.linuxtopia.org/online_books/linux_system_administration/
> debian_linux_guides/debian_linux_reference_guide/ch-gateway.en_009.html
>
> I'm kinda fuzzy on the distinction between 127.0.0.1 and 127.0.1.1 -- the
> first is the loopback, but I don't really understand the purpose of the
> second.
>
> Also, I don't recall putting anything along the lines of line 3 of /etc/
> hosts, so far as it being a FQDN from my ISP. I entered "arrakis" at
> some point, but I wonder that I'm not breaking something which depends
> upon that FQDN from ISP.
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".
Having two "127.0.1.1" is strange - and possibly "illegal".
The "127.0.1.1" entry in Debian/Ubuntu's "/etc/hosts" is a Debian hack
that was prompted (IIRC; I read a long time ago a some debian-devel
posts on this topic) by a desire not to have a box's
systemname/hostname be an alias of "localhost.localdomain" or
"localhost". I've forgotten the reason for this desire!
More information about the ubuntu-users
mailing list