2022
我们一起努力

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

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)”转载,原作者保留一切权利,若侵权请联系删除。

赞(0)
文章名称:《linux服务器CentOS7/6查看防火墙状态及开启关闭命令》
文章链接:https://www.fzvps.com/170739.html
本站文章来源于互联网,如有侵权,请联系管理删除,本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
图片版权归属各自创作者所有,图片水印出于防止被无耻之徒盗取劳动成果的目的。

评论 抢沙发

评论前必须登录!