linux服务器CentOS7/6查看防火墙状态及开启关闭命令

2023-11-25 0 498

CentOS7 的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之前的版本使用iptables不一样

1、关闭防火墙:

systemctl stop firewalld.service connection closed. Disconnected from remote host(.7) at 17:21:23. Type ‘help’ to learn how to use Xshell prompt [d:~]$ Connecting to 192.168.0.7:22… Connection established. To escape to local shell, press ‘Ctrl Alt ]’. Last login: Fri May 12 16:53:10 2017 from 192.168.0.221… [root@localhost ~]# systemctl stop firewalld.service [root@localhost ~]#

2、开启防火墙:

systemctl start firewalld.service

3、关闭开机启动:

systemctl disable firewalld.service

4、开启开机启动:

systemctl enable firewalld.service centos6

存在以下两种方式:

一、service方式

查看防火墙状态:

[root@centos6 ~]# service iptables status

iptables:未运行防火墙。

开启防火墙:

[root@centos6 ~]# service iptables start

关闭防火墙:

[root@centos6 ~]# service iptables stop

二、iptables方式

先进入init.d目录,命令如下:

[root@centos6 ~]# cd /etc/init.d/ [root@centos6 init.d]#

然后

查看防火墙状态:

[root@centos6 init.d]# /etc/init.d/iptables status

暂时关闭防火墙:

[root@centos6 init.d]# /etc/init.d/iptables stop

重启iptables:

[root@centos6 init.d]# /etc/init.d/iptables restart

原文链接:https://blog.csdn.net/xc_zhou/article/details/80879810

来源:zyhot.com/article/5906.html

本站声明:内容来源于网络,内容不代表本站立场,仅供阅读参考,文章版权归原作者“本公司cmy.cn”所有。如有侵权,请联系我们删除。

免责声明:本站发布的内容(图片、视频和文字)以原创、来自本网站内容采集于网络互联网转载等其它媒体和分享为主,内容观点不代表本网站立场,如侵犯了原作者的版权,请告知一经查实,将立刻删除涉嫌侵权内容,联系我们56dr_com,同时欢迎投稿传递力量。

本文从“特网科技(56dr.com)”转载,原作者保留一切权利,若侵权请联系删除。

相关文章

猜你喜欢
官方客服团队

为您解决烦忧 - 24小时在线 专业服务

  • 0 +

    访问总数

  • 0 +

    会员总数

  • 0 +

    文章总数

  • 0 +

    今日发布

  • 0 +

    本周发布

  • 4975 +

    运行天数

你的前景,远超我们想象