问题描述:

一批阿里云机器,发现其中一部分机器没有办法访问smtp.qiye.163.com服务器。相应的业务(docker容器部署)出现报错,在容器里面和宿主机上执行 telnet smtp.qiye.163.com 25 均出现了报错。
报错信息如下:
[root@new ~]# telnet smtp.qiye.163.com 25
Trying 123.125.50.10...
telnet: connect to address 123.125.50.10: Connection timed out
Trying 123.125.50.11...
telnet: connect to address 123.125.50.11: Connection timed out

[root@new ~]# ping 123.125.50.10
PING 123.125.50.10 (123.125.50.10) 56(84) bytes of data.
64 bytes from 123.125.50.10: icmp_seq=1 ttl=52 time=36.2 ms
64 bytes from 123.125.50.10: icmp_seq=2 ttl=52 time=36.1 ms
64 bytes from 123.125.50.10: icmp_seq=3 ttl=52 time=36.1 ms
64 bytes from 123.125.50.10: icmp_seq=4 ttl=52 time=36.1 ms
64 bytes from 123.125.50.10: icmp_seq=5 ttl=52 time=36.1 ms
^C
--- 123.125.50.10 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 36.170/36.187/36.232/0.209 ms


[root@iZwz96060sxkql7ghg525zZ ~]# ping 123.125.50.11
PING 123.125.50.11 (123.125.50.11) 56(84) bytes of data.
64 bytes from 123.125.50.11: icmp_seq=1 ttl=51 time=38.6 ms
64 bytes from 123.125.50.11: icmp_seq=2 ttl=51 time=38.6 ms
64 bytes from 123.125.50.11: icmp_seq=3 ttl=51 time=38.7 ms
64 bytes from 123.125.50.11: icmp_seq=4 ttl=51 time=38.7 ms
64 bytes from 123.125.50.11: icmp_seq=5 ttl=51 time=38.6 ms
64 bytes from 123.125.50.11: icmp_seq=6 ttl=51 time=38.7 ms
64 bytes from 123.125.50.11: icmp_seq=7 ttl=51 time=38.7 ms
^C
--- 123.125.50.11 ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6009ms
rtt min/avg/max/mdev = 38.606/38.704/38.768/0.050 ms


[root@new ~]# ping smtp.qiye.163.com
PING smtp.qiye.163.com (123.125.50.11) 56(84) bytes of data.
64 bytes from 123.125.50.11 (123.125.50.11): icmp_seq=1 ttl=51 time=38.6 ms
64 bytes from 123.125.50.11 (123.125.50.11): icmp_seq=2 ttl=51 time=38.7 ms
64 bytes from 123.125.50.11 (123.125.50.11): icmp_seq=3 ttl=51 time=38.6 ms
64 bytes from 123.125.50.11 (123.125.50.11): icmp_seq=4 ttl=51 time=38.7 ms
64 bytes from 123.125.50.11 (123.125.50.11): icmp_seq=5 ttl=51 time=38.6 ms
^C
--- smtp.qiye.163.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 38.631/38.699/38.770/0.182 ms

[root@new ~]# telnet 123.125.50.11 25
Trying 123.125.50.11...
telnet: connect to address 123.125.50.11: Connection timed out




原因分析:

1、查看问题机器本身的防火墙

[root@new ~]# systemctl status firewalld   #检查了问题机器的防火墙,是关闭的
● firewalld.service - firewalld - dynamic firewall daemon
  Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
  Active: inactive (dead) since Wed 2018-01-31 15:52:28 CST; 2 months 6 days ago
    Docs: man:firewalld(1)
 Process: 27972 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 27972 (code=exited, status=0/SUCCESS)

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
[root@new ~]#

2、换端口访问,发现将25端口换成465端口,就是可以正常访问的:
[root@new ~]# telnet smtp.qiye.163.com 465
Trying 123.125.50.10...
Connected to smtp.qiye.163.com.
Escape character is '^]'.
^C^CConnection closed by foreign host.
[root@new ~]#


最后参考https://www.v2ex.com/amp/t/393296文档发现可能是因为阿里云过滤掉了25端口。



解决方法:

联系阿里云售后,对方提供了手动申请解封25端口的方法:https://help.aliyun.com/knowledge_detail/56130.html  需手动申请解封25端口