开放端口的步骤:
- 查看防火墙是否开启
systemctl status firewalld
- 开放端口号
firewall-cmd --zone=public --add-port=端口号/tcp --permanent
- 更新防火墙规则(必须)
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