如何开放服务器端口?

开放端口的步骤:

  1. 查看防火墙是否开启
	systemctl status firewalld
  1. 开放端口号
  	firewall-cmd --zone=public --add-port=端口号/tcp --permanent
  1. 更新防火墙规则(必须
	firewall-cmd --reload

systemctl-firewall命令

1.查看防火墙的状态

	systemctl status firewalld

2.开启防火墙:

	systemctl start firewalld

3.关闭防火墙:

	systemctl stop firewalld

4.开机启动防火墙:

	systemctl enable firewalld

5.开机禁止防火墙:

	systemctl disable firewalld

6.查看服务是否开机自启:

	systemctl is-enabled firewalld.service

7.查看已启动的服务列表:

	systemctl list-unit-files|grep enable

8.查看启动失败的端口:

	systemctl --failed

firewall-cmd命令

1.查看firewall全部信息:

	firewall-cmd --list-all

2.查看以开放端口:

	firewall-cmd --list-ports

3.开放端口:

	firewall-cmd --zone=public --add-port=8080/tcp --permanent

4.关闭端口:

	firewall-cmd --zone=public --remove-port=8080/tcp --permanent

5.更新防火墙规则:

	firewall-cmd --reload
    原文作者:JingHai.Li
    原文地址: https://blog.csdn.net/Li_Jinghai/article/details/119083142
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞