JetpropelledSnake

 

有的时候,我们需要对系统的防火墙进行操作,今天小编就给大家讲解一下如何开启以及关闭CentOS6.9系统下的防火墙。

输入:cat /etc/issue   查看版本

 

(一)通过service命令

service命令开启以及关闭防火墙为即时生效,下次重启机器的时候会自动复原。

查看防火墙状态:service iptables status  ,记得在CentOS6.9中是输入iptables,网上有些教程使用service iptable status 命令并不可行。

 

关闭防火墙:service iptables stop

 

 

打开防火墙:service iptables start

 

总结:

打开防火墙:service iptables start

关闭防火墙:service iptables stop

查看防火墙状态:service iptables status

 

(二)通过:/etc/init.d/iptables 进行操作

查看防火墙状态:/etc/init.d/iptables/status

 

 

关闭防火墙:/etc/init.d/iptables stop(这是临时关闭,关闭的是当前运行的防火墙,重启之后防火墙又会启动,因为它是开机自启动的)

 

这是临时关闭,关闭的是当前运行的防火墙,重启之后防火墙又会启动,因为它是开机自启动的,它相当于/etc/init.d/iptables start。

 

(三)需要改为开机不启动,使用chkconfig命令

永久开启防火墙: chkconfig iptables on

查看状态:chkconfig --list iptables

 

永久关闭防火墙:

 chkconfig iptables off

 

参考

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-15
  • 2021-12-27
  • 2022-02-14
  • 2022-01-10
  • 2022-12-23
  • 2022-01-07
猜你喜欢
  • 2021-04-27
  • 2021-11-18
  • 2022-12-23
  • 2022-01-12
  • 2021-12-27
  • 2022-01-13
  • 2022-02-19
相关资源
相似解决方案