postfix: Cannot assign requested address
The delivery attempt on the second log excerpt tries to use IPv6
and after failing, falls back to IPv4
and delivers the message successfully. You can either fix your IPv6 host configuration if you have IPv6 upstream connection, or disable it on your system if you don't have IPv6, or you can prevent postfix
from using your broken IPv6
by setting inet_protocols = ipv4
in main.cf
Related videos on Youtube
Kristian
Updated on September 18, 2022Comments
-
Kristian over 1 year
I have app that uses postfix. When i send an email from one user to another, works well, as you can see here
Sep 28 14:34:04 webcat-node-77f77644-vhq94 postfix/smtpd[546]: connect from localhost[127.0.0.1] Sep 28 14:34:04 webcat-node-77f77644-vhq94 postfix/smtpd[546]: EA382280CA4: client=localhost[127.0.0.1] Sep 28 14:34:04 webcat-node-77f77644-vhq94 postfix/cleanup[551]: EA382280CA4: message-id=<504605561.1538145244923.JavaMail.root@webcat-node-77f77644-vhq94> Sep 28 14:34:04 webcat-node-77f77644-vhq94 postfix/qmgr[146]: EA382280CA4: from=, size=1232, nrcpt=1 (queue active) Sep 28 14:34:04 webcat-node-77f77644-vhq94 postfix/smtpd[546]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5 Sep 28 14:34:06 webcat-node-77f77644-vhq94 postfix/smtp[552]: EA382280CA4: to=, relay=smtp.gmail.com[74.125.133.108]:587, delay=1.1, delays=0.01/0.03/0.4/0.69, dsn=2.0.0, status=sent (250 2.0.0 OK 1538145246 h71-v6sm1532424wmg.4 - gsmtp) Sep 28 14:34:06 webcat-node-77f77644-vhq94 postfix/qmgr[146]: EA382280CA4: removed
The problem comes when someone uses the feedback feature in my app.
Sep 28 14:28:21 webcat-node-77f77644-vhq94 postfix/smtpd[531]: connect from localhost[127.0.0.1] Sep 28 14:28:21 webcat-node-77f77644-vhq94 postfix/smtpd[531]: A0507280CA4: client=localhost[127.0.0.1] Sep 28 14:28:21 webcat-node-77f77644-vhq94 postfix/cleanup[535]: A0507280CA4: message-id=<634841788.1538144901634.JavaMail.root@webcat-node-77f77644-vhq94> Sep 28 14:28:21 webcat-node-77f77644-vhq94 postfix/qmgr[146]: A0507280CA4: from=, size=702, nrcpt=1 (queue active) Sep 28 14:28:21 webcat-node-77f77644-vhq94 postfix/smtpd[531]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5 Sep 28 14:28:21 webcat-node-77f77644-vhq94 postfix/smtp[536]: connect to smtp.gmail.com[2a00:1450:400c:c06::6c]:587: Cannot assign requested address Sep 28 14:28:22 webcat-node-77f77644-vhq94 postfix/smtp[536]: A0507280CA4: to=, relay=smtp.gmail.com[74.125.71.108]:587, delay=1.1, delays=0.01/0.02/0.34/0.78, dsn=2.0.0, status=sent (250 2.0.0 OK 1538144902 u4-v6sm3253917wro.47 - gsmtp) Sep 28 14:28:22 webcat-node-77f77644-vhq94 postfix/qmgr[146]: A0507280CA4: removed
This is the content of my
main.cf
:smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) biff = no append_dot_mydomain = no readme_directory = no compatibility_level = 2 smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = myDomain alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydestination = gdfg, $myhostname, localhost.localdomain, localhost relayhost = [smtp.gmail.com]:587 mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_protocols = all inet_interfaces = all smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt smtp_use_tls = yes myorigin = /etc/mailname
-
RalfFriedl over 5 yearsDid you intentionally make the log output unreadable?
-
Michael Hampton over 5 yearsI got lost trying to make sense of the mangled log output. Please see formatting help for help on formatting your post. Then you can edit the question and replace the log output with a freshly pasted copy, and format it using the
{}
code button.
-
-
Michael Hampton over 5 yearsWarning: Disabling IPv6 will make some remote hosts unreachable and is not a good long term solution.
-
AlexD over 5 years@MichaelHampton they already have IPv6 hosts unreachable, but I updated my answer with suggestion to fix IPv6 if they have working IPv6 upstream.
-
Michael Hampton over 5 yearsIndeed. Of course fixing IPv6 is preferred since there are already IPv6-only hosts, their numbers are only growing, and the user will have to email one sooner or later.