CentOS7关闭防火墙、Linux开启关闭防火墙
文章目录
- 一、firewalld开启、关闭防火墙
- 1、查看防火墙状态
一、firewalld开启、关闭防火墙
以下命令在linux系统CentOS7中操作开启关闭防火墙
# 查询防火墙状态
systemctl status firewalld.service
# 开启防火墙
systemctl start firewalld.service
# 开机自启动防火墙
systemctl enable firewalld.service# 关闭防火墙
systemctl stop firewalld.service
# 禁止firewalld服务在系统启动时自动启动
systemctl disable firewalld.service
1、查看防火墙状态
active(running)
:说明防火墙打开disavtive(dead)
:说明防火墙关闭
执行日志:
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: active (running) since 四 2025-06-05 01:54:51 CST; 10min agoDocs: man:firewalld(1)Main PID: 3489 (firewalld)Tasks: 2CGroup: /system.slice/firewalld.service└─3489 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid6月 05 01:54:51 localhost.localdomain systemd[1]: Starting firewalld - dynamic fir....
6月 05 01:54:51 localhost.localdomain systemd[1]: Started firewalld - dynamic fire....
6月 05 01:54:52 localhost.localdomain firewalld[3489]: WARNING: AllowZoneDrifting ....
6月 05 01:54:58 localhost.localdomain firewalld[3489]: WARNING: ALREADY_ENABLED: ssh
6月 05 01:55:07 localhost.localdomain firewalld[3489]: WARNING: AllowZoneDrifting ....
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: inactive (dead)Docs: man:firewalld(1)6月 05 01:54:51 localhost.localdomain systemd[1]: Starting firewalld - dynamic fir....
6月 05 01:54:51 localhost.localdomain systemd[1]: Started firewalld - dynamic fire....
6月 05 01:54:52 localhost.localdomain firewalld[3489]: WARNING: AllowZoneDrifting ....
6月 05 01:54:58 localhost.localdomain firewalld[3489]: WARNING: ALREADY_ENABLED: ssh
6月 05 01:55:07 localhost.localdomain firewalld[3489]: WARNING: AllowZoneDrifting ....
6月 05 02:05:48 localhost.localdomain systemd[1]: Stopping firewalld - dynamic fir....
6月 05 02:05:50 localhost.localdomain systemd[1]: Stopped firewalld - dynamic fire....
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]#
[root@localhost ~]# ^C
[root@localhost ~]#