CentOS7如何开放/查看端口?

  • 来源:网络
  • 更新日期:2020-05-28

摘要:SSH连上服务器,首先看下防火墙有没有开启。查看防火墙状态:systemctl status firewalld 看到active (running)说明已经开启了没有的话,开启防火墙:systemctl start firewalld

SSH连上服务器,首先看下防火墙有没有开启。查看防火墙状态:systemctl status firewalld
看到active (running)说明已经开启了没有的话,开启防火墙:systemctl start firewalld
查看下防火墙所有以开放的端口:firewall-cmd --zone=public --list-ports
开放端口,比如我要开放8888端口:firewall-cmd --zone=public --add-port=8888/tcp --permanent
如果需要关闭这个端口:firewall-cmd --zone=public --remove-port=8888/tcp --permanent
重启防火墙,使配置生效:firewall-cmd --reload
如果想关闭防火墙:systemctl stop firewalld
设置开机启动防火墙:systemctl disable firewalld更多问题请