PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

详解CentOS7防火墙设置

藏色散人
藏色散人 转载
2020-11-24 15:19:56 3245浏览

下面由centos基础教程栏目给大家介绍centos7防火墙设置,希望对需要的朋友有所帮助!

1.查看系统版本

在设置防火墙的时候,首先查看linux系统版本。

lsb_release -a

centOS7 系统没有此命令

cat /etc/redhat-release(/etc/centos-release)
输出:CentOS Linux release 7.4.1708 (Core)

此命令对于CentOS6和CentOS7都可以使用。linux系统中etc文件夹主要用于存放一些配置文件。

2.防火墙相关命令

启动: systemctl start firewalld
查看状态: systemctl status firewalld 
禁止开机启动: systemctl disable firewalld  
关闭服务: systemctl stop firewalld 关闭

3.systemctl命令

systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。使用方法如下:

启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed

注意:CentOS7 以下版本是用iptables为防火墙服务的。

声明:本文转载于:segmentfault,如有侵犯,请联系admin@php.cn删除