iptables 一般使用

Linux 防火墙 iptables 一般使用
1.配置默认规则
iptables -P INPUT ACCEPT #or DROP
iptables -P FORWARD ACCEPT #or DROP
iptables -P OUTPUT ACCEPT #or DROP
2.简单规则
例如允许、禁止22号端口
iptables -A INPUT -p tcp --sport 22 -j ACCEPT
iptables -A INPUT -p tcp --sport 22 -j DROP #or REJECT

3.其它
其它复杂规则请参考官网https://www.netfilter.org/

猜你喜欢

转载自blog.51cto.com/13396187/2542384