firewall:
1、运行命令:
firewall-cmd --get-active-zones

2、执行如下命令命令:
firewall-cmd --zone=public --add-port=8080/tcp --permanent
注:要开放那个端口就在port后面填什么端口

3、重启防火墙,运行命令:
firewall-cmd --reload

4、查看端口号是否开启,运行命令:
firewall-cmd --query-port=8080/tcp

iptables:
1.在/etc/sysconfig/iptables文件中添加要开放的端口。例如:
-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
2.重启iptables
systemctl restart iptables.service
网友评论