我的VM设置了一些访问Web服务器和SSH的规则。服务器在内部端口8080中运行,该内部端口通过iptables使用以下命令重定向到端口80:
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
当我将规则添加到DROP INPUT中,然后添加用于分配端口的规则时
IPTABLES -A INPUT -p tcp --dport 80 -j ACCEPT
它不起作用。
我在SSH服务器的端口4422上具有相同的设置,并且工作正常,但不能在http服务器中使用。
IPTABLES --LIST:
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:4422
ACCEPT all -- anywhere anywhere(this one is for the lo)
ACCEPT tcp -- anywhere anywhere tcp dpt:http
预路由发生在INPUT之前,因此您需要从8080(而不是80)接受。
IPTABLES -A INPUT -p tcp --dport 8080 -j ACCEPT
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句