环境
阿里云 CentOS 7.9
问题描述:
阿里云服务器需要开两个端口:9000和5732
运维的同事告知我已经开开了
服务器上的服务我也已经运行了
但telnet那两个端口出现9000通,5732不通的问题
问题分析:
可能是服务器上防火墙设置的问题
>>> systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2021-04-13 11:39:39 CST; 5h 22min ago
Docs: man:firewalld(1)
Main PID: 3041 (firewalld)
Tasks: 2
Memory: 22.0M
CGroup: /system.slice/firewalld.service
└─3041 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid
防火墙确实在运行中
>>> firewall-cmd --query-port=5732/tcp
You're performing an operation over default zone ('public'),
but your connections/interfaces are in zone 'docker' (see --get-active-zones)
You most likely need to use --zone=docker option.
no
>>> firewall-cmd --query-port=9000/tcp
You're performing an operation over default zone ('public'),
but your connections/interfaces are in zone 'docker' (see --get-active-zones)
You most likely need to use --zone=docker option.
no
可以看到,这两个端口确实没有开放(但为什么9000端口telnet正常,而且确实能访问呢?)
解决办法:
将这两个端口打开
>>> firewall-cmd --add-port=5732/tcp --permanent
You're performing an operation over default zone ('public'),
but your connections/interfaces are in zone 'docker' (see --get-active-zones)
You most likely need to use --zone=docker option.
success
>>> firewall-cmd --reload
success
>>> firewall-cmd --query-port=5732/tcp
You're performing an operation over default zone ('public'),
but your connections/interfaces are in zone 'docker' (see --get-active-zones)
You most likely need to use --zone=docker option.
yes
'telnet xx.xx.xx.xx 5732’通,且确实能够访问
但还有一个问题就是,9000端口显示没有打开,但为什么telnet通,而且访问正常呢?
参考:
https://blog.csdn.net/qq_24232123/article/details/79781527
https://blog.51cto.com/andyxu/2137046