本文共 1163 字,大约阅读时间需要 3 分钟。
1.设置开机启动chkconfig iptables on2.启动iptables/etc/init.d/iptables start3.查看开启的端口/etc/init.d/iptables status可以查看到那些端口已经开启iptables4.某个端口不安全,我们需要关闭/sbin/iptables -I INPUT -p tcp --dport 9889 -j DROP5.开启某个端口/sbin/iptables -I INPUT -p tcp --dport 8011 -j ACCEPT 6.开启之后一定要保存。不然下次还是需要设置 /etc/rc.d/init.d/iptables save 7. linux下清空iptables规则具体方法如下: iptables -t nat -F iptables -t nat -X iptables -t nat -P PREROUTING ACCEPT iptables -t nat -P POSTROUTING ACCEPT iptables -t nat -P OUTPUT ACCEPT iptables -t mangle -F iptables -t mangle -X iptables -t mangle -P PREROUTING ACCEPT iptables -t mangle -P INPUT ACCEPT iptables -t mangle -P FORWARD ACCEPT iptables -t mangle -P OUTPUT ACCEPT iptables -t mangle -P POSTROUTING ACCEPT iptables -F iptables -X iptables -P FORWARD ACCEPT iptables -P INPUT ACCEPT iptables -P OUTPUT ACCEPT iptables -t raw -F iptables -t raw -X iptables -t raw -P PREROUTING ACCEPT iptables -t raw -P OUTPUT ACCEPT8 远程不要使用 关闭所有的 INPUT FORWARD OUTPUT 只对某些端口开放。iptables -P INPUT DROPiptables -P FORWARD DROPiptables -P OUTPUT DROP9 开启80端口/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
转载地址:http://codli.baihongyu.com/