Cloud Platforms- sudo:无法解析主机 [英] Cloud Platforms- sudo: unable to resolve host

查看:106
本文介绍了Cloud Platforms- sudo:无法解析主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将linux用于Amazon-EC2和openstack上的基于云的服务器. 尝试运行时:

I use linux for my cloud based servers on Amazon-EC2 and openstack. When trying to run:

sudo chhown ubuntu somepath

我偶尔会收到此错误:

sudo:无法解析主机

sudo: unable to resolve host

Internet上对该问题的大多数答案是编辑/etc/hosts文件.

Most answers to this question on the internet are to edit the /etc/hosts file.

但是,我会自动部署服务器.除此之外,我没有使用"localhost"登录,而是使用了我的AWS公共DNS:

However, I deploy my servers automatically. besides that, I am not logging on using "localhost", but rather my AWS public DNS:

ssh -i mykey.pem ubuntu@ec2-12-34-56-78.eu-central-1.compute.amazonaws.com

所以我不能只是简单地插入localhost,更不用说重置机器后我的IP可以更改了. (不想为每台服务器浪费"我宝贵的浮动IP)

So I cannot just trivially insert localhost, not to mention that my IP can change after I reset my machine. (Don't want to "waste" my precious floating IPs for every server)

此外,我一次部署了数十台服务器,所以我负担不起编辑文本文件的手动步骤.是否有针对此问题的自动修复程序? 最近,我开始使用openstack,那里也存在这个问题.

Also, I deploy tens of servers at a time, so I cannot afford the manual step of editing a text file. Is there an automated fix for this issue? Recently I've started using openstack, and the issue is present there too.

推荐答案

EC2实例才能正确解析其自动分配的内部主机名.您需要:

EC2 instances inside VPC will resolve their auto-assigned internal hostnames correctly, only if you configure the VPC correctly. You need:

DNS hostnames: yes
DNS resolution: yes

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide /vpc-dns.html

这篇关于Cloud Platforms- sudo:无法解析主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆