# 1.查看防火墙状态
systemctl status firewalld
# 2.暂时关闭防火墙
systemctl stop firewalld
# 3. 永久关闭防火墙
systemctl disable firewalld
# 4.开启防护墙
systemctl start firewalld
# 5.永久开启防火墙
systemctl enable firewalld
# 6.开放指定端口(如:8080)
firewall-cmd --zone=public --add-port=8080/tcp --permanent
# 7.关闭指定端口(如:8080)
firewall-cmd --zone=public --remove-port=8080/tcp --permanent
# 8.立即生效
firewall-cmd --reload
# 9.查看开放端口
firewall-cmd --zone=public --list-ports
评论区