rpm -qa|grep firewalld;rpm -qa|grep firewall-config
输出以下类似信息代表已经安装
firewalld-filesystem-0.5.3-5.el7.noarch
firewalld-0.5.3-5.el7.noarch
firewall-config-0.5.3-5.el7.noarch
如果没有则安装
yum install firewalld firewall-config -y
sudo systemctl start firewalld # 开启防火墙
sudo systemctl enable firewalld # 开机启动防火墙
firewall-cmd --zone=public --add-port=22/tcp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --zone=public --add-port=6349/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --list-ports # 查看当前系统打开的所有端口
firewall-cmd --zone=public --remove-port=22/tcp --permanent
firewall-cmd --reload