FQDN for a postfix/dovecot virtual machine inside host with a single public IP

Erion asked:

I want to install iRedMail (== postfix + dovecot) in a virtual machine inside an internet-facing host with a single IP.

  • The host is named host.mydomain.com with IP 1.2.3.4.
  • The PTR record for 1.2.3.4 is set to host.mydomain.com
  • The SMTP/IMAP ports will be DNAT-ted to the VM on 172.16.1.1

I am not sure what name to give to the VM and whether to give it a FQDN or local name:

  • Every guide I’ve seen says to use a FQDN, not a local name
  • If I name the VM "host.mydomain.com" (same as the host), the DNS resolvers on both VM and host will get confused: is host.mydomain.com 127.0.0.1, 172.16.1.1, or 1.2.3.4 ?
  • If I name the VM with a different FQDN, the PTR record for the IP will not match the host name anymore and the mails will be marked as spam.

I can change the PTR if necessary, but I’d rather avoid it unless it brings clear advantages. (It is easy to forget when moving/upgrading servers and some poor soul will lose sleep over why things suddenly don’t work anymore.)

What’s the best approach in this case and what settings (if any) do I need in the postfix/dovecot configs?

My answer:


You can make Postfix identify itself as an arbitrary name by setting myhostname= explicitly in main.cf.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.