in my postfix logs I often see that postfix failed to send an email to root@levinus [my hostname] because theres no DNS record for levinus. But in my /etc/hosts is an entry for levinus (--> 127.0.0.1 AND my static IP). With ping I can reach levinus, then I ping myself. But why postfix doesnt accepts the /etc/hosts entrys?
Piece of the postfix log:
BC59A2FE000B: to=<root@levinus>, relay=none, delay=0.03,
delays=0.01/0/0.02/0, dsn=5.4.4, status=bounced (Host or domain name not
found. Name service error for name=levinus type=AAAA: Host not found)
Oct 11 14:47:29 levinus postfix/qmgr[29217]: BC59A2FE000B: removed
Part of /etc/hosts:
[STATIC IP] levinus
127.0.0.1 localhost.localdomain localhost levinus
System is Ubuntu 14.04 LTS.
//Edit With inet_protocols = ipv4 in main.cfg from postfix the same. Only the error message is another (type = A). When I add levinus to the IPv6 entry ::1 in /etc/hosts its the same (type = AAAA)
//Edit2
postfix logs even with the levinus
hostname:
Oct 12 14:40:33 levinus postfix/smtpd[10103]: connect from levinus[127.0.0.1]
Oct 12 14:40:33 levinus postfix/smtpd[10103]: disconnect from levinus[127.0.0.1]
But all mails too root@levinus are still bounced.
Even when I edit the /etc/nsswitch.conf to hosts: files
only postfix dont knew the own hostname. Before it was set to hosts: files dns
.
AAAA
record is different fromA
record.AAAA
is for IPv6, the one you have in /etc/hosts is IPv4