linux – 设置主机名:FQDN还是短名称?

前端之家收集整理的这篇文章主要介绍了linux – 设置主机名:FQDN还是短名称?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我注意到设置系统主机名的“首选”方法在Red Hat / CentOS和Debian / Ubuntu系统之间根本不同.

CentOS documentationRHEL deployment guide说主机名应该是FQDN:

HOSTNAME=<value>@H_403_7@,where <value>@H_403_7@ should be the Fully Qualified Domain
Name (FQDN),such as hostname.example.com@H_403_7@,but can be whatever
hostname is necessary.

RHEL install guide稍微含糊不清:

Setup prompts you to supply a host name for this computer,either as a
fully-qualified domain name (FQDN) in the format hostname.domainname
or as a short host name in the format hostname.

The Debian reference表示主机名不应使用FQDN:

3.5.5. The hostname

The kernel maintains the system hostname. The init script in runlevel
S which is symlinked to “/etc/init.d/hostname.sh” sets the system
hostname at boot time (using the hostname command) to the name stored
in “/etc/hostname“. This file should contain only the system hostname,
not a fully qualified domain name.

我没有看到IBM提出哪些具体建议,但some software似乎有偏好.

我的问题:

>在异构环境中,使用供应商建议或选择一个并在所有主机上保持一致是否更好?
>您遇到的哪个软件对主机名是设置为FQDN还是短名称很敏感?

解决方法

我会在整个环境中选择一致的方法.两种解决方案均可正常工作,并可与大多数应用程但是,可管理性存在差异.

我使用短名称作为HOSTNAME设置,并将FQDN设置为服务器IP的/ etc / hosts中的第一列,然后是短名称.

我没有遇到过许多强制执行或显示两者之间偏好的软件包.我发现短名称对某些应用程序更清晰,特别是日志记录.也许我看到像server.northside.chicago.rizzomanufacturing.com这样的内部域名是不吉利的.谁想在日志或shell提示符中看到它?

有时,我参与公司收购或重组,内部域和/或子域名发生变化.我喜欢在这些情况下使用短主机名,因为日志记录,kickstart,打印,系统监控等不需要完全重新配置来考虑新域名.

具有内部域“ifp.com”的名为“rizzo”的服务器的典型RHEL / CentOS服务器设置如下所示:

/etc/sysconfig/network:
HOSTNAME=rizzo
...

/etc/hosts:
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

172.16.100.13   rizzo.ifp.com rizzo

[root@rizzo ~]# hostname 
rizzo

/var/log/messages snippet:
Dec 15 10:10:13 rizzo proftpd[19675]: 172.16.100.13 (::ffff:206.15.236.182[::ffff:206.15.236.182]) - Preparing to               
 chroot to directory '/app/upload/GREEK'
Dec 15 10:10:51 rizzo proftpd[20660]: 172.16.100.13 (::ffff:12.28.170.2[::ffff:12.28.170.2]) - FTP session opened.
Dec 15 10:10:51 rizzo proftpd[20660]: 172.16.100.13 (::ffff:12.28.170.2[::ffff:12.28.170.2]) - Preparing to chroot                
to directory '/app/upload/ftp/SRRID'

猜你在找的Linux相关文章