0 iptables
这些是我的 IPTABLES 规则:
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p udp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 53 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name DEFAULT --rsource
iptables -A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m recent --update --seconds 180 --hitcount 4 --name DEFAULT --rsource -j DROP
iptables -A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT
iptables -A OUTPUT -j REJECT
iptables -A INPUT -j REJECT
iptables -A FORWARD -j REJECT
Run Code Online (Sandbox Code Playgroud)
我使用远程 ssh 连接来设置它们,但是在我设置之后:
iptables -A OUTPUT -j REJECT
Run Code Online (Sandbox Code Playgroud)
我的连接丢失了。我已经阅读了 Iptables 的所有文档,我可以找出任何东西,INPUT 的全局拒绝运行良好,因为我可以访问网页,但是我的 ssh 超时。任何的想法?
谢谢
TCP 流上使用的端口不是对称的:当服务器(守护程序)端侦听端口 22 时,客户端将使用随机高编号 (1024+) 端口。如果您对目标端口进行过滤,那么这些将被阻止。在拒绝行之前,您将需要类似 'iptables -A OUTPUT -m state --state ESTABLISHED,RELATED' 之类的内容,以使对外部请求的回复有效。
归档时间: |
|
查看次数: |
3874 次 |
最近记录: |