firewalld重启(比如运行:service firewalld restart)超时解决方案(或firewalld无法启动、或无法重启):
一般使用命令 systemctl status firewalld 提示:
Failed to start firewalld - dynamic firewall daemon
可以依次运行以下命令:
systemctl stop firewalld
pkill -f firewalld
systemctl start firewalld
firewalld常用重启命令:
查看状态:
systemctl status firewalld
启动:
systemctl start firewalld
关闭:
systemctl stop firewalld
开机启用 :
systemctl enable firewalld
开机禁用 :
systemctl disable firewalld
查看开放的端口:
firewall-cmd --list-ports
添加端口:
firewall-cmd --add-port=22/tcp --permanent
封IP:
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="165.232.0.0/16" port protocol="tcp" port="22" reject"
(–permanent 表示永久生效,写入XML配置文件,重启仍有效)
重新载入配置:
firewall-cmd --reload