无法让 Postfix 使用不同的公共 IP 进行 SMTP

无法让 Postfix 使用不同的公共 IP 进行 SMTP

DigitalOcean 上的 Ubuntu 18.04,Postfix 3.3.0

postconf-n:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
content_filter = smtp-amavis:[127.0.0.1]:10024
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = $myhostname
myhostname = mail.tohuw.net
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_bind_address = 174.138.126.177
smtp_tls_CAfile = /etc/postfix/fullchain.pem
smtp_tls_cert_file = /etc/postfix/fullchain.pem
smtp_tls_key_file = /etc/postfix/privkey.pem
smtp_tls_loglevel = 1
smtp_tls_mandatory_protocols = !SSLv2,!SSLv3
smtp_tls_note_starttls_offer = yes
smtp_tls_protocols = !SSLv2,!SSLv3
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_tls_session_cache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_CAfile = /etc/postfix/fullchain.pem
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/postfix/fullchain.pem
smtpd_tls_key_file = /etc/postfix/privkey.pem
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3
smtpd_tls_protocols = !SSLv2,!SSLv3
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_tls_session_cache
tls_random_source = dev:/dev/urandom
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_mailbox_base = /var/mail/vhosts
virtual_mailbox_domains = tohuw.net
virtual_mailbox_maps = hash:/etc/postfix/vmailbox

我已经设置smtp_bind_address = 174.138.126.177nslookup mail.tohuw.net返回了预期的 IP。但在 mail.log 中我看到:

postfix/smtp[21941]: warning: smtp_connect_addr: bind 174.138.126.177: Cannot assign requested address

我猜我需要在网络层面配置一些东西,但是做什么呢?/etc/network/interfaces只是:

auto lo
iface lo inet loopback
source /etc/network/interfaces.d/*

请注意,没有interfaces.d目录。

答案1

默认情况下,您应该已经为服务器设置了 127.0.0.1,不要绑定它。将 main.cf 中的 mydestination 设置为:

myhostname = mail.tohuw.net
mydomain = tohuw.net
mydestination = $myhostname, localhost.$mydomain, localhost

将 myhostname 保留在 mydestination 之上

并在 /etc/hosts 中插入:

127.0.0.1 mail.tohuw.net,mail

相关内容