大网数据广告活动
服务器运维问答

postfix: Cannot assign requested address

· 52CE 我爱测

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-…

问题原文

原帖链接 · Kristian · CC BY-SA 4.0

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

社区高分解答

原帖链接 · AlexD · CC BY-SA 4.0

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-09-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。