centos如何查看防火墙状态
时间: 2023-05-17 13:03:48 浏览: 198
防火墙设置软件。需要管理员权限,一键开启关闭和查看
您可以使用以下命令来查看CentOS防火墙的状态:
systemctl status firewalld
如果防火墙正在运行,您将看到以下输出:
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-06-01 14:28:22 UTC; 1h 30min ago
Docs: man:firewalld(1)
Main PID: 1234 (firewalld)
Tasks: 2 (limit: 1152)
Memory: 17.1M
CGroup: /system.slice/firewalld.service
└─1234 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Jun 01 14:28:22 centos7 systemd[1]: Starting firewalld - dynamic firewall daemon...
Jun 01 14:28:22 centos7 systemd[1]: Started firewalld - dynamic firewall daemon.
如果防火墙未运行,则会看到以下输出:
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2021-06-01 14:28:22 UTC; 1h 30min ago
Docs: man:firewalld(1)
Process: 1234 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 1234 (code=exited, status=0/SUCCESS)
Jun 01 14:28:22 centos7 systemd[1]: Starting firewalld - dynamic firewall daemon...
Jun 01 14:28:22 centos7 systemd[1]: Started firewalld - dynamic firewall daemon.
在这种情况下,您需要启动防火墙:
systemctl start firewalld
如果您想在系统启动时自动启动防火墙,请使用以下命令:
systemctl enable firewalld
阅读全文