- 查看防火墙某个端口是否开放
firewall-cmd —query-port=80/tcp - 开放防火墙端口80
firewall-cmd —zone=public —add-port=80/tcp —permanent - 关闭80端口
- firewall-cmd —zone=public —remove-port=80/tcp —permanent
- 配置立即生效
- firewall-cmd —reload
- 查看防火墙状态
systemctl status firewalld - 关闭防火墙
systemctl stop firewalld - 打开防火墙
systemctl start firewalld - 开放一段端口
firewall-cmd —zone=public —add-port=8121-8124/tcp —permanent - 查看开放的端口列表
firewall-cmd —zone=public —list-ports
firewall-cmd —zone=public —add-port=80/tcp —permanent