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 (--> 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 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[]
Oct 12 14:40:33 levinus postfix/smtpd[10103]: disconnect from levinus[]

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 from A record. AAAA is for IPv6, the one you have in /etc/hosts is IPv4 – Aizuddin Zali Oct 11 '15 at 12:58

The problem is not with IPv4 address but IPv6 due to AAAA record is not exist.

This can be resolved by switching postfix to use only IPv4. sudo postconf -e 'inet_protocols = ipv4' then reload postfix.

  • Edited question, i isnt a solution :( – levinus Oct 11 '15 at 13:20
  • check in /etc/nsswitch.conf which option is the first one for dns line? – Aizuddin Zali Oct 11 '15 at 13:27
  • There wasnt a dns line, only the hosts line with the option dns: hosts: files dns – levinus Oct 11 '15 at 14:07
  • Have you any idea for a solution to this? – levinus Oct 13 '15 at 18:10
  • you need to disable IPv6 . Use this guide. – Aizuddin Zali Oct 14 '15 at 4:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.