介绍
带有 Centos 6.7 i686 的新 digitalocean droplet(centos-release-6-7.el6.centos.12.3.i686)
Nginx 1.1.13 (从源代码构建):
赛勒斯:
$ sudo yum install cyrus-sasl cyrus-imapd $ sudo vi vi /etc/cyrus.conf: -> https://gist.github.com/c80609a/7190c4981365447063ce2e06a517d9fd $ sudo vi /etc/sasl2/smtpd.conf: -> pwcheck_method: auxprop -> auxprop_plugin: sasldb -> mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 ... $ sudo chkconfig --level 345 cyrus-imapd on $ sudo service cyrus-imapd start $ sudo service cyrus-imapd status -> cyrus-imapd (pid 1851) is running...
POSTFIX(postfix-2.6.6-6.el6_7.1.i686)
$ sudo yum install postfix $ sudo vi /etc/postfix/master.cf -> https://gist.github.com/c80609a/07b397d2baa7455896bb704aa2a7479a $ sudo vi /etc/postfix/main.cf -> https://gist.github.com/c80609a/831168401df84b395c393b09a3cda384 $ sudo vi /etc/postfix/virtual: [email protected] webmaster\@site.org $ sudo postmap /etc/postfix/virtual $ sudo touch /etc/postfix/body_checks $ sudo service postfix stop $ sudo service postfix reload $ sudo postfix upgrade-configuration $ sudo service postfix start $ sudo service postfix status master (pid 16811) is running... $ sudo postfix status postfix/postfix-script: the Postfix mail system is running: PID: 16811
添加了两条记录(digitalocean.com -> 登录 -> 网络):
A mail 95.85.24.200 MX 5 mail.site.org.
邮件发送成功:
$ echo 'test' | mail -s 'test' [email protected]
问题
Telnet 连接被拒绝:
$ telnet localhost 25 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'.
尝试谷歌主机-确定:
$ telnet gmail-smtp-in.l.google.com 25 Trying 74.125.136.26... Connected to gmail-smtp-in.l.google.com. Escape character is '^]'. 220 mx.google.com ESMTP t6si2618629wjt.255 - gsmtp quit 221 2.0.0 closing connection t6si2618629wjt.255 - gsmtp Connection closed by foreign host.
意外的 netstat 输出(最后一列未定义):
$ netstat -ln |grep :25 tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
预期结果:
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 16811/master
我该如何解决这些问题?
答案1
您收到的连接被拒绝仅发生在 IPv6 上,在 IPv4 地址 (127.0.0.1) 上您确实可以连接。如果您想启用 IPv6,您需要在 中添加以下行main.cf
:
inet_protocols = ipv4, ipv6
关于 netstat 输出,您需要使用-p
开关显示进程名称,比较:
mtak@dc2:~$ netstat -ln | grep 25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
tcp6 0 0 :::25 :::* LISTEN
和
mtak@dc2:~$ sudo netstat -pln | grep 25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 3102/master