Topic: Purpose of listing FQDN first in /etc/hosts?
==== Required information ====
- iRedMail version: 0.8.6
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: CentOS 6.5 (OpenVZ VPS container)
- Related log if you're reporting an issue:
====
Something isn't clear to me at the "Set a fully qualified domain name (FQDN) hostname on your server" section in http://www.iredmail.org/install_iredmail_on_rhel.html.
I am installing iRedMail on a VPS at home. (This means, my physical machine runs CentOS, and it has several virtual machines also running CentOS, using OpenVZ. One of these virtual systems is the system we're going to talk about here.)
The documentation says about /etc/hosts: "Warning: List the FQDN hostname as first item." When I do that like in the documentation's example ("127.0.0.1 mail.XX.XX mail localhost, etc.) and reboot, OpenVZ restores the /etc/hosts file to the one OpenVZ prefers in which the FQDN is not listed as first item. There must be a reason for OpenVZ doing this, like ensuring that a virtual system runs correctly. This is the /etc/hosts file OpenVZ likes me to use:
[root@mail ~]# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost localhost4.localdomain4 localhost4
# Auto-generated hostname. Please do not remove this comment.
192.168.XX.XX mail.XX.XX mail
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
(I masked IP address and FQDN for privacy/security/whatever.)
The choice to be made is between these two options:
A.) Leave /etc/hosts as it is, and thus obeying OpenVZ's preference and neglecting iRedMail's warning.
B.) Obey iRedMail's warning and automatically restore a corrected /etc/hosts file at every boot, having the FQDN listed first. This can be done by adding a few lines to the /etc/rc.d/rc.local script.
Both options result in a correct FQDN when issuing "hostname -f". Option B results in mentioning something in the nightly log analysis like "/etc/hosts and iRedMail's hosts file are different".
My question is, what is the purpose of having the FQDN listed first? And what are the consequences if I don't?
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.