要检查Linux上的防火墙状态,可以执行以下命令:
对于Ubuntu、Debian或基于Systemd的发行版:
sudo systemctl status ufw
对于CentOS、RHEL或基于SysV的发行版:
sudo systemctl status firewalld
这些命令将显示防火墙的状态信息,包括是否已启用和正在运行。
要关闭Linux上的防火墙,请按照以下步骤操作:
对于Ubuntu、Debian或基于Systemd的发行版:
-
停止防火墙服务:
sudo systemctl stop ufw
-
禁用防火墙服务以在下次启动时保持关闭状态:
sudo systemctl disable ufw
-
验证防火墙是否已关闭:
sudo systemctl status ufw
对于CentOS、RHEL或基于SysV的发行版:
-
停止防火墙服务:
sudo systemctl stop firewalld
-
禁用防火墙服务以在下次启动时保持关闭状态:
sudo systemctl disable firewalld
-
验证防火墙是否已关闭:
sudo systemctl status firewalld