我正在尝试让 SMTP(以及 IMAP、POP、IMAPS 等)在我的 haproxy 服务器上运行,但似乎无法真正允许流量通过。
每当我通过 telnet 连接到我的 ip 的 25 端口时,我都会得到:(587 也是一样)
Connection failed: No connection could be made because the target machine actively refused it
当我做:
netstat -a | egrep 'Proto|LISTEN'
结果如下:
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 *:smtp *:* LISTEN
tcp 0 0 localhost:6010 *:* LISTEN
tcp 0 0 *:https *:* LISTEN
tcp 0 0 localhost:6011 *:* LISTEN
tcp 0 0 *:7999 *:* LISTEN
tcp 0 0 *:3336 *:* LISTEN
tcp 0 0 *:submission *:* LISTEN
tcp 0 0 *:http *:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 localhost:6010 [::]:* LISTEN
tcp6 0 0 localhost:6011 [::]:* LISTEN
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 8712 /var/run/dbus/system_bus_socket
unix 2 [ ACC ] SEQPACKET LISTENING 7484 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 1395 @/com/ubuntu/upstart
unix 2 [ ACC ] STREAM LISTENING 9960 /var/run/acpid.socket
哦,我已经尝试了多个不同的例子,例如:
defaults
mode http
contimeout 4000
clitimeout 3600000
srvtimeout 3600000
balance roundrobin
listen MyMail-1 *:25
bind *:110,*:135
bind *:139,*:443
bind *:60000,*:60001
bind *:6001-6004
bind *:587,*:993-995
disabled
mode tcp
option persist
balance roundrobin
stick-table type ip size 10240k expire 30m
stick on src
server HC-CAS1 10.1.2.246 weight 1 check port 80 inter 5000 rise 2 fall 3
#server HC-CAS2 10.10.10.21 weight 1 check port 80 inter 5000 rise 2 fall 3
option redispatch
option abortonclose
maxconn 40000
现在我把它弄得尽可能简单:
listen email_proxy :25,:587
mode tcp
balance roundrobin
server srv1 10.1.2.246 check port 25 inter 30000 rise 1 fall 2
所以我的机器说它正在监听,并且可以从外部访问 haproxy 机器(端口 80/443 流量),没问题,我也可以通过我的公共静态 ip 访问我的统计信息页面。
如果有人能帮助我我将不胜感激。