服务器:Ubuntu Server 10.04 LTS
我的iptables被锁定所以只允许ssh和http流量.我试图隧道sql示例:ssh -L 3306:127.0.0.1:3306 my@domain.com如果我将INPUT设置为ALLOW但它可以正常工作你可以在下面看到它的设置下降所以我的端口被阻止.我认为这只是我需要添加的规则,但我在谷歌上找到的所有内容都失败了.想法?
iptables.up.rules
*filter :INPUT DROP [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [57:4388] -A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -i eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -p icmp -m icmp --icmp-type any -j ACCEPT -A INPUT -j REJECT --reject-with icmp-port-unreachable COMMIT
终端输出
xxx@xxx:/etc# iptables -L Chain INPUT (policy DROP) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ACCEPT tcp -- anywhere anywhere tcp dpt:www ACCEPT icmp -- anywhere anywhere icmp any Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination
您需要允许数据包通过环回到达:
原文链接:https://www.f2er.com/ubuntu/347997.html-A INPUT -i lo -j ACCEPT
您可以通过确保通过环回到达的数据包也具有环回地址来稍微收紧规则:
-A INPUT -d 127.0.0.1/32 -i lo -j ACCEPT