Postfix 无法在 Ubuntu VPS 服务器上发送邮件,网络不可达/连接超时

Postfix 无法在 Ubuntu VPS 服务器上发送邮件,网络不可达/连接超时

我在使用 postfix 时遇到了问题。当我尝试从命令行发送一些邮件时,我收到:

Feb 14 12:44:35 some-server postfix/smtp[1022]: connect to gmail-smtp-in.l.google.com[2a00:1450:4010:c07::1a]:25: Network is unreachable
Feb 14 12:45:05 some-server postfix/smtp[1022]: connect to gmail-smtp-in.l.google.com[64.233.164.27]:25: Connection timed out
Feb 14 12:45:05 some-server postfix/smtp[1022]: connect to alt1.gmail-smtp-in.l.google.com[2404:6800:4008:c07::1a]:25: Network is unreachable
Feb 14 12:45:35 some-server postfix/smtp[1022]: connect to alt1.gmail-smtp-in.l.google.com[64.233.189.27]:25: Connection timed out
Feb 14 12:45:35 some-server postfix/smtp[1022]: connect to alt2.gmail-smtp-in.l.google.com[2404:6800:4008:c01::1b]:25: Network is unreachable
Feb 14 12:45:35 some-server postfix/smtp[1022]: D23CB41F3B: to=<[email protected]>, relay=none, delay=60, delays=0.03/0/60/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[2404:6800:4008:c01::1b]:25: Network is unreachable)

当我尝试 telnet 到 smtp.gmail.com:25 时:

 ~$ telnet smtp.gmail.com 25
Trying 64.233.164.108...

然后它就挂了。

知道为什么它不起作用吗?我应该检查什么?防火墙 25 端口(也是 465/587)已打开,main.cf 配置:

    # See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
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

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = some-server.e24cloud.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = some-server.domain, some-server.e24cloud.com, localhost.e24cloud.com, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

编辑:

ifconfig 和 ufw 设置:

eth0      Link encap:Ethernet  HWaddr 52:54:00:9b:81:8a  
          inet addr:12.34.56.78  Bcast:255.255.248.0  Mask:255.255.248.0
          inet6 addr: fe80::5054:ff:fe9b:818a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1460047 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1482450 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:224872395 (224.8 MB)  TX bytes:5739336340 (5.7 GB)

ufw status
Status: active

To                         Action      From
--                         ------      ----
Apache                     ALLOW       Anywhere
3306                       ALLOW       Anywhere
21/tcp                     ALLOW       Anywhere
115/tcp                    ALLOW       Anywhere
14956                      ALLOW       Anywhere
25/tcp                     ALLOW       Anywhere
587                        ALLOW       Anywhere
12257/tcp                  ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
443                        ALLOW       Anywhere
Apache Full                ALLOW       Anywhere
Bind9                      ALLOW       Anywhere
Apache Secure              ALLOW       Anywhere
OpenSSH                    ALLOW       Anywhere
1022/tcp                   ALLOW       Anywhere
12257                      ALLOW       Anywhere
25                         ALLOW       Anywhere
22                         ALLOW       Anywhere
9418/tcp                   ALLOW       Anywhere
21 (v6)                    ALLOW       Anywhere (v6)
Apache (v6)                ALLOW       Anywhere (v6)
3306 (v6)                  ALLOW       Anywhere (v6)
21/tcp (v6)                ALLOW       Anywhere (v6)
115/tcp (v6)               ALLOW       Anywhere (v6)
14956 (v6)                 ALLOW       Anywhere (v6)
25/tcp (v6)                ALLOW       Anywhere (v6)
587 (v6)                   ALLOW       Anywhere (v6)
12257/tcp (v6)             ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
443 (v6)                   ALLOW       Anywhere (v6)
Apache Full (v6)           ALLOW       Anywhere (v6)
Bind9 (v6)                 ALLOW       Anywhere (v6)
Apache Secure (v6)         ALLOW       Anywhere (v6)
OpenSSH (v6)               ALLOW       Anywhere (v6)
1022/tcp (v6)              ALLOW       Anywhere (v6)
12257 (v6)                 ALLOW       Anywhere (v6)
25 (v6)                    ALLOW       Anywhere (v6)
22 (v6)                    ALLOW       Anywhere (v6)
9418/tcp (v6)              ALLOW       Anywhere (v6)

相关内容