Debian – Postfix warning when sending mail: hostname does not resolve to address xxx.xxx.xxx.xxx

debianhostnamehostspostfix

Every time I send an email, I get this line in /var/log/mail.warn:

postfix/submission/smtpd[xxxxx]: warning: hostname <FQDN> does not resolve to address xxx.xxx.xxx.xxx

I've obviously already Google'd the issue; my /etc/host.conf has "multi=on" as the only entry, I've tried to add the following two lines to /etc/postfix/main.cf:

smtp_host_lookup = native #(also tried "dns", for that matter)
import_environment = MAIL_CONFIG MAIL_DEBUG MAIL_LOGTAG TZ XAUTHORITY DISPLAY LANG=C RESOLV_MULTI=on

Nothing helped. I suspect the issue lies in the nature of the server's config; it's a Hetzner server which has a different internal IP, see here: https://wiki.hetzner.de/index.php/VServer/en#Why_does_my_VM_have_a_different_IP_from_the_one_shown_in_the_Robot.3F

But I can't figure out how to fix that. I've used this guide for mailserver setup, so most config files are 100% as in here:

https://thomas-leister.de/sicherer-mailserver-dovecot-postfix-virtuellen-benutzern-mysql-ubuntu-server-xenial/

For the sake of completeness, here's /etc/hosts:

# IPv4
127.0.0.1 localhost.localdomain localhost
# (old) 172.xx.xx.xx  Debian-85-jessie-64-LAMP
172.xx.xx.xx mysrv.mydomain.tld mysrv
#
# IPv6
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
xxx:xxx:xxx:xxx::2  Debian-85-jessie-64-LAMP

Best Answer

Just to answer my own question (not sure if that's violating any rules or not):

I've replaced the internal Hetzner IP with the public one in /etc/hosts and everything works fine now, the warning is gone. I have no idea why the public one isn't entered there by default, and if there's any drawback to changing that.