开放端口:
机器默认仅开通了22端口
我们只需查看实例详情,点击【虚拟云网络】

然后点击子网中的数据!

再点安全列表中的数据。

可以看到【入站规则】3条,可见仅开放了22端口!ICMP 也是关闭的(禁ping)!
删除第2条和第3条,保留第1条
编辑第1条数据。将目的地端口范围里的数据清空!保存即可!
切记!切记!切记!同时还需要关闭iptables 或者 firewalld
大叔我在这里慢慢悠悠折磨了3天,找不到为什么不能开放端口!no zuo no die
我当时是CentOS 8,防火墙相关命令:
CentOS7默认使用firewalld防火墙
# 查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
firewall-cmd --state
或者
systemctl status firewalld
# 开启firewall
systemctl start firewalld.service
或
service firewalld start
# 停止firewall
systemctl stop firewalld.service
或
service firewalld stop
# 重启firewall
systemctl restart iptables.service
或
service firewalld restart
# 设置firewall开机启动
systemctl enable iptables.service
# 禁止firewall开机启动
systemctl disable firewalld.service
# 查看防火墙规则
firewall-cmd --list-all
# 开放80端口
firewall-cmd --permanent --add-port=80/tcp
# 移除端口
firewall-cmd --permanent --remove-port=8080/tcp
# 重启防火墙(修改配置后要重启防火墙)
firewall-cmd --reload
iptables
# 查看防火墙状态
service iptables status
# 关闭iptables
service iptables stop
# 启动防火墙
service iptables start
# 重启防火墙
service iptables restart
# 永久关闭防火墙
chkconfig iptables off
# 永久关闭后重启
chkconfig iptables on