清除原有规则.

不管你在安装linux时是否启动了防火墙,如果你想配置属于自己的防火墙,那就清除现在filter的所有规则.
[root@tp ~]# iptables -F        清除预设表filter中的所有规则链的规则
[root@tp ~]# iptables -X        清除预设表filter中使用者自定链中的规则
我们在来看一下
[root@tp ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target      prot opt source                destination         
Chain FORWARD (policy ACCEPT)
target      prot opt source                destination         
Chain OUTPUT (policy ACCEPT)
target      prot opt source                destination     
什么都没有了吧,和我们在安装linux时没有启动防火墙是一样的.(提前说一句,这些配置就像用命令配置IP一样,重起就会失去作用),怎么保存.
[root@tp ~]# /etc/rc.d/init.d/iptables save
 
这样就可以写到/etc/sysconfig/iptables文件里了.写入后记得把防火墙重起一下,才能起作用.
[root@tp ~]# service iptables restart

相关文章:

  • 2021-05-27
  • 2021-08-27
  • 2021-11-18
  • 2021-05-29
  • 2021-12-29
  • 2021-06-25
  • 2021-10-03
猜你喜欢
  • 2021-12-04
  • 2021-12-09
  • 2021-07-14
  • 2022-01-04
  • 2021-09-11
  • 2021-05-21
  • 2021-08-16
  • 2022-03-08
相关资源
相似解决方案