我在Google Compute实例上运行postfix。它正在监听0.0.0.0:25,我在防火墙上打开了端口25,但我无法从外部连接到它。我查看了this和this,但他们没有解决我的问题。我在Google Compute文档中没有看到任何可以解释这一点的内容。
端口在防火墙上打开:
% gcutil --project=XXX getfirewall smtp
+---------------+-------------------------------+
| name | smtp |
| description | Incoming smtp allowed. |
| creation-time | 2014-06-08T13:29:16.052-07:00 |
| network | default |
| source-ips | 0.0.0.0/0 |
| source-tags | |
| target-tags | |
| allowed | tcp: 25 |
+---------------+-------------------------------+
从外面,我可以连接到端口80(也是开放的)......
% telnet 108.XXX.XXX.XXX 80
Trying 108.XXX.XXX.XXX...
Connected to 108.XXX.XXX.XXX.
Escape character is '^]'.
GET /
<!DOCTYPE html>
<html ...>
...
</html>Connection closed by foreign host.
...但不是25号港口:
% telnet 108.XXX.XXX.XXX 25
Trying 108.XXX.XXX.XXX...
telnet: connect to address 108.XXX.XXX.XXX: Operation timed out
telnet: Unable to connect to remote host
postfix正在侦听所有接口:
% gcutil --project=XXX ssh --zone=us-central1-a XXX sudo netstat -lpn -A inet
...
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
...
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 10794/master
...
我可以查找“外部”地址......
% gcutil --project=XXX ssh --zone=us-central1-a XXX /sbin/ifconfig eth0
...
eth0 Link encap:Ethernet HWaddr 42:01:0a:XX:XX:XX
inet addr:10.XXX.XXX.XXX Bcast:10.XXX.XXX.XXX Mask:255.255.255.255
UP BROADCAST RUNNING MULTICAST MTU:1460 Metric:1
RX packets:46397953 errors:0 dropped:0 overruns:0 frame:2
TX packets:34953374 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5031906871 (4.6 GiB) TX bytes:49375287245 (45.9 GiB)
...并从框中telnet到端口25:
% gcutil --project=XXX ssh --zone=us-central1-a XXX telnet 10.XXX.XXX.XXX 25
...
Trying 10.XXX.XXX.XXX...
Connected to 10.XXX.XXX.XXX.
Escape character is '^]'.
220 XXX ESMTP Postfix (Debian/GNU)
EHLO localhost
250-XXX
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
QUIT
221 2.0.0 Bye
Connection closed by foreign host.
非常感谢任何帮助。
答案 0 :(得分:1)
正如@GregHewgill和@complistic在各自的评论中指出的那样,我的ISP(或中间人)没有为端口25路由流量。我无法连接到我的直接LAN之外的任何端口25。我以前从未注意到这一点,这有点令人尴尬。
希望任何有类似问题的人都可以在像我一样无知地旋转轮子之前找到这个问题(和答案)。
感谢大家的帮助!
答案 1 :(得分:0)