centos-7启动安装firewalld防火墙

1、yum 安装
yum install firewalld firewall-config -y

2、启动firewall
systemctl start firewalld

3、查看状态
systemctl status firewalld

4、显示当前服务
firewall-cmd –list-services

5、查看开放的端口
firewall-cmd –zone=public –list-ports

6、添加端口
firewall-cmd –zone=public –add-port=80/tcp –permanent
firewall-cmd –zone=public –add-port=443/tcp –permanent
firewall-cmd –zone=public –add-port=22/tcp –permanent

7、查看端口是否打开
firewall-cmd –query-port=8000/tcp

8、关闭端口
firewall-cmd –permanent –remove-port=8000/tcp

9、热重启防火墙
firewall-cmd –reload