查看已开放的端口
firewall-cmd --list-ports
开放单个端口(开放后需要要重启防火墙才生效)
firewall-cmd --zone=public --add-port=80/tcp --permanent
关闭端口(关闭后需要要重启防火墙才生效)
firewall-cmd --zone=public --remove-port=8080/tcp --permanent
查看端口是否打开
firewall-cmd --zone= public --query-port=80/tcp
开启防火墙
systemctl start firewalld
重启防火墙 (两种方式)
firewall-cmd --reload
systemctl restart firewalld
设置开机启动防火墙
systemctl enable firewalld
设置开机关机防火墙
systemctl disabled firewalld