password
URL
type
status
date
slug
summary
tags
category
icon
周起始
标签
是否汉化
最近在腾讯云中的doker中上搭建各种服务,防火墙和服务什么的都排查了,公网就是无法访问到,内网可以访问,在此记录下排查方案(问题出现在了第三步)
环境:腾讯云Centos 服务器
问题:当启动一个容器向外部暴露端口时,服务器公网IP:端口号
无法访问
一、未打开安全组策略
暴露给外部的端口需要打开对应的安全组设置,全部打开 😁,就需要添加如下的安全组配置

二、防火墙开放端口未设置
首先查看防火墙是否开启,结果为not running表示未开启,则不是防火墙的问题,跳过
查看防火墙是否开启
查看防火墙所开放的端口
也可以用firewall-cmd --list-all查看防火墙的详细信息

开放防火墙的对外暴露的端口
如: 开放90端口(--premanent表示永久添加)
重启防火墙(修改配置后要重启防火墙)
添加完成后再次查看就可以看到90端口被开放

三、没有启用IP_FORWARD
这个问题一般不会出现,默认都是打开的,我们用如下命令查看

结果为
1
则表示启动,为0
则未启动,用如下命令启动执行完成后,重启服务器或使用下面的命令从文件中加载配置:

离开乏味的皮囊,自由的灵魂在路上
- Name: Alan Hsu
- Tag: 随感、技术、经验、旅行、推荐、生活、音乐、电影 etc.
- Email:xulanzhong521gmail.com
- Twitter:@AlanHsu521
- Telegram:@AlanHsu521
- WeChat: Alan_Hsu_521
- Github: https://github.com/xsoway/
- Blog: https://xmylog.com


- Author:Alan_Hsu
- URL:https://xmylog.com/article/articles_docker_port
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts