1、firewall防火墙
查看firewall服务状态
systemctl status firewalld
或
firewall-cmd --state
启动、关闭、重启防火墙
#开启
systemctl start firewalld
#关闭
systemctl stop firewalld
#重启
systemctl restart firewalld
#禁用防火墙服务
systemctl disable firewalld
#启用防火墙服务
systemctl enable firewalld
查看防火墙规则
firewall-cmd --list-all
查看端口是否开放/开放端口/移除端口
#查看端口是否开放
firewall-cmd --query-port=8080/tcp
#开放端口
firewall-cmd --permanent --add-port=80/tcp
#移除端口
firewall-cmd --permanent --remove-port=8080/tcp
#修改配置需重启防火墙
systemctl restart firewalld
来源:oschina
链接:https://my.oschina.net/u/4108765/blog/3192858