Discussion:
Setting a FQDN
(too old to reply)
Warren Post
2013-03-22 14:04:15 UTC
Permalink
I'm trying to understand the generally accepted best practice for
setting a fully qualified domain name on Linux generally and on Mageia 2
specifically. My efforts to RTFM and STFW lead me to so much
contradictory information that I am confused, not enlightened.

Here's what I understand; please correct my errors:

To check your short host name, as user run:

hostname

And to check your FQDN, add the "-f" argument:

hostname -f

Then to change your short host name and FQDN (replacing "host" and
"host.domain.tld" as appropriate), as root edit /etc/hosts to contain
the lines:

127.0.0.1 localhost.localdomain localhost
127.0.0.1 host.domain.tld host

Also as root, edit /etc/sysconfig/network to contain the line:

HOSTNAME=host.domain.tld

Reboot and check your work as above. When all is well, add the files you
edited to your backup set.

Is the above best practice? If not, what should I be doing?
--
Warren Post
http://my.opera.com/wpost/
David W. Hodgins
2013-03-22 18:56:03 UTC
Permalink
Post by Warren Post
Then to change your short host name and FQDN (replacing "host" and
"host.domain.tld" as appropriate), as root edit /etc/hosts to contain
127.0.0.1 localhost.localdomain localhost
127.0.0.1 host.domain.tld host
HOSTNAME=host.domain.tld
Reboot and check your work as above. When all is well, add the files you
edited to your backup set.
Is the above best practice? If not, what should I be doing?
In addition to the above, before rebooting ...
echo "host.domain.tld">/etc/hostname

Regards, Dave Hodgins
--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
unruh
2013-03-22 19:13:02 UTC
Permalink
/etc/hostname
Post by Warren Post
I'm trying to understand the generally accepted best practice for
setting a fully qualified domain name on Linux generally and on Mageia 2
specifically. My efforts to RTFM and STFW lead me to so much
contradictory information that I am confused, not enlightened.
hostname
hostname -f
Then to change your short host name and FQDN (replacing "host" and
"host.domain.tld" as appropriate), as root edit /etc/hosts to contain
127.0.0.1 localhost.localdomain localhost
127.0.0.1 host.domain.tld host
HOSTNAME=host.domain.tld
Reboot and check your work as above. When all is well, add the files you
edited to your backup set.
Is the above best practice? If not, what should I be doing?
Bit Twister
2013-03-22 20:45:36 UTC
Permalink
Post by Warren Post
I'm trying to understand the generally accepted best practice for
setting a fully qualified domain name on Linux generally and on Mageia 2
specifically. My efforts to RTFM and STFW lead me to so much
contradictory information that I am confused, not enlightened.
hostname
hostname -f
For some distributions, you might find -f the default.
As with all commands, do check the "man some_command_here" for what
applies for any given installation.
Post by Warren Post
Then to change your short host name and FQDN (replacing "host" and
"host.domain.tld" as appropriate), as root edit /etc/hosts to contain
127.0.0.1 localhost.localdomain localhost
127.0.0.1 host.domain.tld host
Just a NOTE: after running any GUI network configuration tool,
cat /etc/hosts
Post by Warren Post
HOSTNAME=host.domain.tld
/etc/sysconfig/network will be distribution specific.
Post by Warren Post
Reboot and check your work as above.
CAUTION. Changing those files while running within a GUI desktop, can
cause you to lose display activity/service/usability/...

The reboot is required so all services/daemons can obtain the new hostname.
Post by Warren Post
When all is well, add the files you edited to your backup set.
That is a good policy for any configuration change. Just keep in mind
that reloading old release configuration files in a new install might
put you in the ditch. :(
Post by Warren Post
Is the above best practice? If not, what should I be doing?
Except for the file David and unruh mentioned, you did pretty good.

FYI: If your domain.tld is not registered, I suggest using .invalid or .test
see why at http://www.rfc-editor.org/rfc/rfc2606.txt

This is for any lurkers. Unless you are authorized to use the domain.tld
in your email address, I suggest changing it to
***@mouse-potato.com or @nomail.afraid.org

To see where that would route any email sent to your address,
check the ip address from
ping -c1 mouse-potato.com
ping -c1 nomail.afraid.org
Pinnerite
2013-03-22 22:32:24 UTC
Permalink
Post by Warren Post
I'm trying to understand the generally accepted best practice for
setting a fully qualified domain name on Linux generally and on Mageia 2
specifically. My efforts to RTFM and STFW lead me to so much
contradictory information that I am confused, not enlightened.
hostname
hostname -f
Then to change your short host name and FQDN (replacing "host" and
"host.domain.tld" as appropriate), as root edit /etc/hosts to contain
127.0.0.1 localhost.localdomain localhost
127.0.0.1 host.domain.tld host
HOSTNAME=host.domain.tld
Reboot and check your work as above. When all is well, add the files you
edited to your backup set.
Is the above best practice? If not, what should I be doing?
By chance I happened to be fiddling around with samba.
I tried changing localhost from the mcc, both in Mageia 2 and
Mageia 3 (beta 3). On a reboot, the latter was back to localhost.
i haven't rebooted the Mageia 2 machine but I'll bet it's the same.
Given that you need to be root to get into the mcc, this seems to
be less than useful.

Or to put it another way, I'm interested too.
--
___________________________________________________

Mageia 2 for x86_64, Kernel: 3.4.34-desktop-1.mga2
KDE version 4.8.5 Running on an AMD 4-core processor
Bit Twister
2013-03-22 23:05:17 UTC
Permalink
Post by Pinnerite
By chance I happened to be fiddling around with samba.
I tried changing localhost from the mcc, both in Mageia 2 and
Mageia 3 (beta 3). On a reboot, the latter was back to localhost.
Gotta love those GUI apps. :(

My solution is to do the install, run my new_install script which
copies in my backup /etc/hosts file. I set all the desktops as static
and all systems have the same /etc/hosts file.

And just to keep everything honest it modifies /etc/nsswitch.conf
$ dif /etc/nsswitch.conf_vinstall /etc/nsswitch.conf
49c49,51
< hosts: mdns4_minimal files nis dns myhostname mdns4
---
Post by Pinnerite
# patched by /local/bin/nsswitch_changes
# hosts: mdns4_minimal files nis dns myhostname mdns4
hosts: files dns myhostname
Warren Post
2013-03-22 23:38:46 UTC
Permalink
Post by Pinnerite
I tried changing localhost from the mcc, both in Mageia 2 and
Mageia 3 (beta 3). On a reboot, the latter was back to localhost.
Perhaps this thread can help?

http://narkive.com/0XNDVdxD
--
Warren Post
http://my.opera.com/wpost/
Pinnerite
2013-03-23 14:01:24 UTC
Permalink
I cold-booted both machines today and the respective hostnames were as I had
set them. I've been caught before by not cold booting. Will I ever learn?
--
___________________________________________________

Mageia 2 for x86_64, Kernel: 3.4.34-desktop-1.mga2
KDE version 4.8.5 Running on an AMD 4-core processor
Continue reading on narkive:
Loading...