- 查看防火墙状态
systemctl status firewalld
- 锁定防火墙
systemctl mask firewalld.service
- 解锁防火墙
systemctl unmask firewalld.service
- 开启防火墙
systemctl start firewalld.service
- 关闭防火墙
systemctl stop firewalld.service
- 开机启动防火墙
systemctl enable firewalld.service
- 关闭开机启动
systemctl disable firewalld.service
- 开放端口
#(--permanent永久生效,没有此参数重启后失效)
#注:可以是一个端口范围,如1000-2000/tcp
firewall-cmd --zone=public --add-port=80/tcp --permanent
- 重载防火墙
firewall-cmd --reload
- 移除端口
firewall-cmd --zone=public --remove-port=80/tcp --permanent
#
firewall-cmd --permanent --remove-port=123/tcp
- 查询已开放端口
firewall-cmd --list-port