Ec2 instance on AWS apt- get not working

前端 未结 5 1833
小鲜肉
小鲜肉 2020-12-14 17:21

I have Ec2 instance on AWS with Amazon Ubuntu.

When i try to download any thing, I am unable to do so.

For Ex:

~# apt-get update

0% [Connect         


        
相关标签:
5条回答
  • 2020-12-14 17:39

    adding outbound rule HTTP TCP 80 0.0.0.0/0 work for me.

    0 讨论(0)
  • 2020-12-14 17:39

    I faced same issue because I did not enable nat gateway for private subnet in vpc.

    If your machine is in private subnet you'll have to enable nat gateway in route table for that subnet.

    It ll look like this after enabled

    0 讨论(0)
  • 2020-12-14 17:52

    I figured out how to get apt-get to work again.

    Edit gai.conf:

    sudo vim /etc/gai.conf

    change line ~54 to uncomment the following:

    precedence ::ffff:0:0/96 100

    write and quit:

    :wq

    CAUTION

    Look out line 50 which looks almost identical:

    precedence ::ffff:0:0/96 10

    This is the wrong line. Go ~4 lines down and you'll find the correct line to uncomment because it ends with 100 instead of 10

    0 讨论(0)
  • 2020-12-14 17:55

    You EC2 instances's Security groups is not configured to let it reach internet. You need to have an Outbound rule for all traffic to 0.0.0.0/0. In EC2-Classic, this is already in place and hence you need not worry. However, if this is in VPC, then you need to add this rule.

    Also, Apart from what is said above, could you check whether any iptables rules causing any issue.

    0 讨论(0)
  • 2020-12-14 17:57

    Also make sure that if you want to download anything using wget using HTTPS link .Then add Outbound Rule for HTTPS ( Port 443 ) to 0.0.0.0/0

    0 讨论(0)
提交回复
热议问题