安装防火墙:
yum install firewalld systemd -y
查看防火墙状态:
systemctl status firewalld 或 firewall-cmd --state
关闭防火墙:
systemctl stop firewalld 或
开启防火墙:
systemctl start firewalld
重启防火墙:
systemctl reload firewalld 或 firewall-cmd --reload
查看防火墙开机是否启动:
systemctl is-enabled firewalld
开机禁用防火墙:
systemctl disable firewalld
开放端口:
firewall-cmd --add-port=9300/tcp
永久开放端口:
firewall-cmd --add-port=9300/tcp --permanent
关闭端口:
firewall-cmd --remove-port=9300/tcp
永久关闭端口:
firewall-cmd --remove-port=9300/tcp --permanent
查看已经开放的端口:
firewall-cmd --list-ports
如果报错:FirewallD is not running 就是防火墙未开启