Noob question on hosts file

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
User avatar
opsystem
Posts: 33
Joined: Mon Nov 20, 2017 6:32 pm

Noob question on hosts file

Post by opsystem »

Hi all,

I know that every installation (with or without split DNS) should have these entries in /etc/hosts file:

Code: Select all

127.0.0.1 localhost.localdomain localhost
[local network IP] [FQDN] [hostname]
Now why can't I just use the loopback address instead of the external one, provided that I'm on a single server installation?

Code: Select all

127.0.0.1 localhost.localdomain localhost [FQDN] [hostname]
Here Someone says that "some protocols" like SIP could have problems when advertising the sender IP of packets, but is this true inside Zimbra, where all MTA and related services communicate whitin a single host? Also, my config has BIND9 running as internal caching server so there's no need for any resolution mapping in the hosts file.

(side note: in my current line "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" are localhost.localdomain and localhost4 localhost4.localdomain4 necessary or are they leftovers from installation/migration? can I delete them?)
Thanks!
phoenix
Ambassador
Ambassador
Posts: 27278
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Re: Noob question on hosts file

Post by phoenix »

If you only used the loopback address in the hosts file how would mail get delivered to you ZCS server. As the loopback address is non-routable and only relates to the localhost there is no way to deliver email to that server unless you have a public ip or private lan ip (with port forwarding from a firewall or some other router).

If you want to test it then try removing all the entries from the hosts file except for the loopback and see how you get on with that and also test it without the DNS server running (to simulate a DNS failure).
Regards

Bill

Rspamd: A high performance spamassassin replacement

Per ardua ad astra
User avatar
opsystem
Posts: 33
Joined: Mon Nov 20, 2017 6:32 pm

Re: Noob question on hosts file

Post by opsystem »

Ok, so in the last few days I’ve done it:

/etc/hosts:

Code: Select all

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 [myserver FQDN] [myserver host name]
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
nothing else
/etc/resolf.conf:

Code: Select all

nameserver 127.0.0.1
BIND9:

Code: Select all

[myserver.externaldomain]	A	Default	127.0.0.1
[myserver FQDN]	A	Default	127.0.0.1
And all is running smoothly, as all services are on the same machine. Obviously sent emails have the Received headers with the (localhost [127.0.0.1]) part but it doesn’t seem to be an issue for now (but I've not yet tried to stop BIND)...
Post Reply