brent timothy saner on 28 Aug 2015 14:19:41 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] FQDN vs hostname


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 08/28/2015 03:47 PM, Joe Rosato wrote:
> This caused a somewhat heated debate at Jefferson today. Turns out that
> Redhat has one standard and debian another. Ah standards! Can't argue
> with them, because they are standards.
> 
> When you type in 'hostname' - I am used to just getting a single name.
> But then again, I'm in the Debian camp (Ubuntu). Redhat is happy with a
> FQDN hostname.
> 
> Thought I would throw it out here to see if I can draw blood or make
> someone go mailman on us! Thoughts?
> 
> BTW - I will have info on that job once the man gets back to me for
> those that asked!
> 
> Joe Rosato
> -- 
> Joe

A lot of this is arbitrary difference in opinion, as neither CentOS nor
Debian style is 'right' (I WILL say the CentOS style is more *common*).

Example:

[root@alpha ~]# hostname
alpha.sysadministrivia.com
[root@alpha ~]# hostname -d
sysadministrivia.com
[root@alpha ~]# hostname -s
alpha
[root@alpha ~]# hostname -f
alpha.sysadministrivia.com


Here we see three different sets of output from Arch (but CentOS/RHEL
users should be familiar).

Let's compare to a Debian instance I have in my lab:

root@debian:~# hostname
debian
root@debian:~# hostname -s
debian
root@debian:~# hostname -f
debian.btest
root@debian:~# hostname -d
btest


Now, of course "btest" isn't a valid Internet-level domain. But you get
the picture.


So we can see, they actually *do* "understand" the FQDN/hostname the
same way, and use the same standards (as in the same switches will
return the same expected set of information).

What differs is which form they default to, which is not standardized
and shouldn't be expected as a standard. :) Much in the same way of
uname's strings (namely, -p):

[root@centos ~]# uname -p
x86_64
[root@alpha ~]# uname -p
unknown

(latter is Arch: Linux alpha.sysadministrivia.com 4.0.7-2-ARCH #1 SMP
PREEMPT Tue Jun 30 07:50:21 UTC 2015 x86_64 GNU/Linux)

In this way, it is better to rely on uname -m rather than uname -p, as
not all distributions use -p.

So long story short, if you're writing scripts that are intended to be
run across different distributions, use the switches. :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCgAGBQJV4NBaAAoJEIwATC+TSB9rq8IQAIDak6I+RY2Xkl0jOtKLtRmp
UHFH3CVsnctV9NS+ArH153xtteTrky8tGwlOc3mMK23HIMY0bwkarZFYl0X4uj6/
z9OJMZLuEVJAvjeeFRk//F4pXhKKAnwCDHx0F8HM3ksPUEyri5jahVcI2rlTKvkb
z1O+2/Q4ex4eqLYO6X0pu9MqWPM/EwbWSdWKNWBczdEs9gSOkwQIdVzrrjiRNRRk
/J1AO1zEhmC2fSsGB/36ISux5A3Na74pLkqs6tGoZHNxbOHZtHIqGvzntM/l2s+9
SlZE8aqb+AEIY6ZM2Q3bWmAywN5qMNVoV4SS7W/OgtMBQFeR4l7gVnVQTZoKkFAo
iZoSar9NNk6ExFgTrMAYnlC3aj6kJk/3l3pwQwsez0DSbtvOn8UFYK3+fXDQD/l+
jZkuh/o47hN+zevEdW+V2Wouh9S+Q4Qd/jXzJoeUpZj6I64xMpdtEU5LyeLVSlZ3
ABoqcCqsRPTqVNkt0nlfm2cNQAb/1q6HSvHJPYJGdqQIntr4Hlc3vOqJm26/ghUB
0fUdYlmRTvh0USzA6VVTPEzSMFO5BEVCZOfdfay7WvSN7e0R5yqm0d+ChVvoLSrR
uITcvCHzKGpPPW5M0r/kx1c1N7a4+Ypr4sty2CZTCBz47ml02UHp/Q4qjbVEYTqE
FOqZjrAiiiD+locQEocI
=+epN
-----END PGP SIGNATURE-----
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug