1.iptables -L:列出当前防火墙规则 2.iptables -F:清空所有防火墙规则 3.iptables -P INPUT DROP:将输入规则设置为拒绝所有 4.iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT:允许来自192.168.0.0/24网段的数据包 5.iptables -A OUTPUT -d 192.168.0.0/24 -j ACCEPT:允许向192.168.0.0/24网段发送数据包 6.iptables -A FORWARD -s 192.168.0.0/24 -j ACCEPT:允许从192.168.0.0/24网段转发数据包 7.iptables -A INPUT -p tcp --dport 22 -j ACCEPT:允许来自TCP端口22的数据包 8.iptables -A OUTPUT -p tcp --dport 22 -j ACCEPT:允许向TCP端口22发送数据包 9.iptables -A INPUT -i eth0 -j ACCEPT:允许来自eth0接口的数据包 10.iptables -A OUTPUT -o eth0 -j ACCEPT:允许向eth0接口发送数据包

防火墙常用命令

原文地址: https://www.cveoy.top/t/topic/62K 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录