Centos7 处理服务器端口

1.查看防火墙状态
firewall-cmd --state
2.查看防火墙是否开机自启
systemctl is-enabled firewalld.service;echo $?
3.开启防火墙
systemctl start firewalld.service
4.关闭防火墙
systemctl stop firewalld.service
5.防火墙设置开机自启
systemctl enable firewalld.service
6.防火墙重启
systemctl restart firewalld.service

7.开启防火墙端口
开端口命令:firewall-cmd --zone=public --add-port=80/tcp --permanent

然后重启防火墙:systemctl restart firewalld.service

检验防火墙是否开启
netstat -ntlp
firewall-cmd --list-ports

8.查看已经开启的端口信息
firewall-cmd --zone=public --list-ports