CentOS7下开启端口
开启端口:
firewall-cmd --zone=public --add-port=80/tcp --permanent
命令含义:
--zone #作用域
--add-port=80/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效
重启防火墙:
firewall-cmd --reload 或者service firewalld restart
关闭防火墙:
service firewalld stop
# systemctl start firewalld # 启动,
# systemctl enable firewalld # 开机启动
# systemctl stop firewalld # 关闭
# systemctl disable firewalld # 取消开机启动
$ firewall-cmd --state #查看运行状态