新的 AWS EC2 出站流量問題?

新的 AWS EC2 出站流量問題?

我一直在遵循 LinuxAcademy 上的教程來設定 VPC 和 EC2 執行個體。我已經正確完成了所有操作並啟動了實例,然後通過 ssh 進入它,然後我嘗試更新 yum 並收到此錯誤:

Could not retrieve mirrorlist http://repo.us-east-2.amazonaws.com/latest/main/mirror.list error was
12: Timeout on http://repo.us-east-2.amazonaws.com/latest/main/mirror.list: (28, 'Connection timed out after 5001 milliseconds')


 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: amzn-main/latest

所以我仔細檢查了以下內容:

  • 有公有彈性ip

  • IGW設定

  • 公共子網路設定和 ACL 允許 0.0.0.0/0 上的所有出站流量

  • 安全群組允許所有出站流量

最後,當我查看這些設定時,我對實例不滿意,現在當我嘗試 ssh 回來時,它超時了,而且我也無法遠端 ping ip。

我也嘗試過重新啟動實例,但這沒有幫助。

編輯:這是我的螢幕截圖以及我正在嘗試設定的教程中的圖表

秒_g1

秒_g2

秒_g3

NACL1

NACL2

NACL3

圖表

答案1

您的問題出在您的 NACL 上。您僅允許連接埠 22/tcp 和 80/tcp 上的入站。

當您建立網路連線時,它會在連接埠 80 或 443 上出站,但會在隨機的高連接埠返回。安全群組是有狀態的,允許返回連接,但不允許網路 ACL。

如果您允許 1024-65535/tcp,您的網路連線應該可以運作。

相關內容