gpt4 book ai didi

amazon-web-services - 使用 NAT 实例为私有(private) Ec2 实例提供 Internet 访问

转载 作者:行者123 更新时间:2023-12-04 08:58:36 25 4
gpt4 key购买 nike

我能够通过 NAT 实例将我的私有(private) Ec2 实例连接到互联网。
wget google.com 成功。
但是当我将 NACL 附加到我的私有(private)子网时。我无法连接到互联网。谁能告诉我我的 NACL 出了什么问题。
10.0.1.0/24 和 10.0.2.0/24 是公有子网的CIDR(有NAT实例)
私有(private) NACL 入站规则
enter image description here
私有(private) NACL 出站规则
enter image description here
此外,当我添加规则以接受来自互联网的所有流量时。它可以工作。添加此规则是否正确?

最佳答案

根据评论。
该问题是由于阻止了入站 Internet 流量 (0.0.0.0/0)。来自 Instances cannot access the internet在 AWS 文档中,要使用 NAT 启用实例的 Internet 访问,必须确保以下内容:

Ensure that the network ACLs that are associated with the private subnet and public subnets do not have rules that block inbound or outbound internet traffic. For the ping command to work, the rules must also allow inbound and outbound ICMP traffic.


评论中的问题:

But just one question how will whitelisting work in this case. If I only want to download certain libraries using the internet and not allow any api requests ?


如果您知道要从中下载这些库的公共(public)服务器的 IP 范围,那么您可以将 Internet 流量限制在这些范围内。但如果范围不固定或未知,您必须在规则中允许所有 (0.0.0.0/0) 互联网流量。
通常,安全组被用作控制网络流量的主要方式。 NACL 很好,因为它们具有否认能力。安全组不能明确拒绝流量,因此 NACL 在您想要明确拒绝某些 IP 的情况下很有帮助。但就您而言,您只允许流量。因此我认为使用 默认 NACL 就足够了,可以考虑。

关于amazon-web-services - 使用 NAT 实例为私有(private) Ec2 实例提供 Internet 访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63665251/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com