firewall-cmd --version
# 0.4.4.4
firewall-cmd --state
# running
firewall-cmd --zone=public --add-port=80/tcp --permanent
# success
命令含义: –zone #作用域 –add-port=80/tcp #添加端口,格式为:端口/通讯协议 –permanent #永久生效,没有此参数重启后失效 重启防火墙,这里开启80端口即可。
systemctl restart firewalld
启动:# systemctl start firewalld 重启:# systemctl restart firewalld 查看状态:# systemctl status firewalld 或者 firewall-cmd –state 停止:# systemctl disable firewalld 禁用:# systemctl stop firewalld