我一直在尝试在端口 80 上的一台外部服务器上远程登录。
使用 iptables:
telnet XYZ 80
Trying XYZ...
Connected to XYZ.
Escape character is '^]'.
qwer (here i type some characters)
HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
Transfer-Encoding: chunked
Date: Tue, 03 Sep 2013 16:58:31 GMT
Connection: close
0
Connection closed by foreign host.
关闭 iptables:
telnet XYZ 80
Trying XYZ...
Connected to XYZ.
Escape character is '^]'.
qwer (here i type some characters)
Getting back html response (It's working here, with iptables off)
输出: iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere abcd state NEW tcp dpt:http
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
在 /etc/iptables.conf 文件中,我完成了端口转发(出于安全考虑,将 80 端口传入 Web 流量重定向到 Apache 8080 端口,反之亦然):
:PREROUTING ACCEPT [2:100]
:POSTROUTING ACCEPT [20:1650]
:OUTPUT ACCEPT [20:1650]
-A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
-A OUTPUT -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
COMMIT
在 iptables 中执行什么操作以使端口 80 上的 XYZ 服务器上的 telnet 正常工作,因为如果我关闭 iptables 就可以了?