雷达智富

首页 > 内容 > 程序笔记 > 正文

程序笔记

Centos7.x 防火墙

2024-09-03 16

CentOS 7.x 默认使用的是firewall作为防火墙,取代6.x的iptables

1. 查看防火墙状态


命令如下

firewall-cmd --state

该命令有两种结果:runningnot running;前者代表是开启状态,后者代表是关闭状态

在 vmware 上安装的centos7最小化镜像防火墙默认是开机自启的

2. 修改防火墙状态的相关命令(后缀 .service 可以省略)


开启防火墙

systemctl start firewalld.service

关闭防火墙

systemctl stop firewalld.service

防火墙开机自启

systemctl enable firewalld.service

重启防火墙

systemctl restart firewalld.service

禁止防火墙开机自启

systemctl disable firewalld.service

3. 测试以上命令时可能会用到关机重启命令,在此也写下吧


重启

reboot

关机(其实有很多方式,这里只写一种)

init 0
更新于:16天前
赞一波!

文章评论

全部评论