OCI子网上的端口无法打开

huangapple go评论52阅读模式
英文:

Ports won't open on OCI subnet

问题

我使用的是Oracle Cloud(免费层),端口无法打开。使用的是Ubuntu 22.04 LTS,无法联系Oracle获取支持,因为免费层不包括支持。

我尝试通过指定端口和打开所有端口来打开端口(明确一下,这不是我的意图,我只是试图让它们打开),无论我使用什么设置。

端口配置

OCI子网上的端口无法打开

英文:

I am using Oracle Cloud (free tier) and the ports will not open. Using Ubuntu 22.04 LTS and cannot contact Oracle for support as the free tier doesn't include it.

I have tried opening ports by specifying them, and just opening all ports (to be clear this is not what I intend to do, I am just attempting to get them to open at all) and no matter what settings I use.

Port Configuration

OCI子网上的端口无法打开

答案1

得分: 1

@pmdba 正确,你应该检查本地防火墙规则。

在Ubuntu上,规则保存在 /etc/iptables/rules.v4

如果你想打开80/TCP端口,你可以编辑这个文件并包括以下内容:

-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT

记得在以下行之前添加它:

-A INPUT -j REJECT --reject-with icmp-host-prohibited

这个规则拒绝一切。

之后:

sudo iptables-restore < /etc/iptables/rules.v4

你也可以手动运行iptables来添加所需的规则,一旦满意,记得保存。在保存之前要记得备份 :). 你可以使用以下命令保存:

sudo iptables-save > /etc/iptables/rules.v4

英文:

@pmdba is correct, and you should check the local firewall rules.

On ubuntu, the rules are saved in /etc/iptables/rules.v4

If you want to open port 80/TCP, you can edit this file and include the following:

-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT

Remember to add it before:

-A INPUT -j REJECT --reject-with icmp-host-prohibited

This rule rejects everything.

After that:

sudo iptables-restore < /etc/iptables/rules.v4

You can also run iptables manually to add the desired rule(s), and once you are satisfied, save it. Remember to save and make a backup before :). You can save using:

sudo iptables-save > /etc/iptables/rules.v4

huangapple
  • 本文由 发表于 2023年3月7日 05:15:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/75655922.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定