Home >System Tutorial >LINUX >Redhat 7 Linux system firewall: enabling, disabling and status checking

Redhat 7 Linux system firewall: enabling, disabling and status checking

PHPz
PHPzOriginal
2024-07-24 15:43:231147browse

Redhat 7 Linux 系统防火墙:启用、禁用与状态检查

How to stop/start and disable/enable firewall on Redhat7Linux system

The firewall on Redhat7Linux system is enabled by default. There is generally no need to disable the firewall linux firewall on boot , but it can be very convenient for testing purposes, etc. On Redhat7Linux systems, the firewall runs as the firewalld daemon. Bellow command can be used to detect firewall status:

[root@rhel7 ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
 Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
 Active: active (running) since Thu 2014-09-04 19:18:47 EST; 3 months 28 days ago
 Main PID: 539 (firewalld)
 CGroup: /system.slice/firewalld.service
 └─539 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Sep 04 19:18:45 rhel7 systemd[1]: Starting firewalld - dynamic firewall daemon...
Sep 04 19:18:47 rhel7 systemd[1]: Started firewalld - dynamic firewall daemon.

From the previous output we can see that the firewall is enabled, which means it will be started manually after reboot, but is currently active. It is reported that you can even detect all currently applied rules using:

[root@rhel7 ~]# iptables-save

linux防火墙开机启动_防火墙开启端口linux_防火墙开机启动命令

Stop and start RHEL7 firewall

The firewall on Redhat7 Linux system can be stopped with the following linux command:

防火墙开机启动命令_防火墙开启端口linux_linux防火墙开机启动

[root@rhel7 ~]# service firewalld stop
Redirecting to /bin/systemctl stopfirewalld.service

After the system restarts, the stopped firewall will start again. To start the firewall on Redhat7Linux system linux firewall startup on boot RAR FOR LINUXlinux system download, please use:

[root@rhel7 ~]# service firewalld start
Redirecting to /bin/systemctl startfirewalld.service

Disable and enable RHEL7 firewall

To completely disable the RHEL7 firewall so running after a reboot will not load:

[root@rhel7 ~]# systemctl disable firewalld
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'

Now, the firewall fails to start after system restart. To enable the firewall again:

[root@rhel7 ~]# systemctl enable firewalld
ln -s '/usr/lib/systemd/system/firewalld.service' '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
ln -s '/usr/lib/systemd/system/firewalld.service' '/etc/systemd/system/basic.target.wants/firewalld.service'

The above is the detailed content of Redhat 7 Linux system firewall: enabling, disabling and status checking. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn