EC2 无法解析私有 DNS 主机名 [英] EC2 could not resolve private DNS host name

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

问题描述

我是亚马逊网络服务 (AWS) 的新手

I am new to Amazon Web Service (AWS)

我刚刚创建了一个 VPC 和一个位于其中的子网.但是,我无法解析此子网中的任何主机名(当我留在此子网中的任何主机中时)

I just created a VPC and and a subnet, which is inside it. However, I could not resolve any hostnames in this subnet (when I stay in any hosts in this subnet)

[ec2-user@ip-192-168-1-86 ~]$ nslookup
> ip-192-168-1-86.ec2.internal
Server:     192.168.1.2
Address:    192.168.1.2#53

** server can't find ip-192-168-1-86.ec2.internal: NXDOMAIN

我仔细检查了我的 VPC 是否启用了 DNS 解析并且私有 DNS 主机名是正确的在此处输入图片描述

I have double check that DNS resolution is enabled for my VPC and private DNS hostname is correct enter image description here

推荐答案

来自 AWS DNS 文档

From the AWS DNS documentation

当您在 VPC 中启动一个实例时,它总是会收到一个私有的DNS 主机名.

When you launch an instance into a VPC, it always receives a private DNS hostname.

DNS 解析取决于 enableDnsHostnamesenableDnsSupport 标志.

The DNS resolution depends on the enableDnsHostnames and enableDnsSupport flags.

默认情况下,这两个属性在默认 VPC 或 VPC 中都设置为 true由 VPC 向导创建.默认情况下,只有 enableDnsSupport属性在以任何其他方式创建的 VPC 中设置为 true.

By default, both attributes are set to true in a default VPC or a VPC created by the VPC wizard. By default, only the enableDnsSupport attribute is set to true in a VPC created any other way.

根据 enableDnsHostnamesenableDnsSupport 标志,以下规则适用:

Depending upon the enableDnsHostnames and enableDnsSupport flags following rules apply:

如果两个属性都设置为 true,则会发生以下情况:

If both attributes are set to true, the following occurs:

  • 具有公共 IP 地址的实例会收到相应的公共 DNS 主机名.
  • Amazon Route 53 Resolver 服务器可以解析 Amazon 提供的私有 DNS 主机名.

如果其中一个或两个属性设置为 false,则会发生以下情况:

If either or both of the attributes is set to false, the following occurs:

  • 具有公共 IP 地址的实例不会收到相应的公共 DNS 主机名.
  • Amazon Route 53 解析器无法解析 Amazon 提供的私有 DNS 主机名.
  • 如果 DHCP 选项集中有自定义域名,则实例会接收自定义私有 DNS 主机名.如果您没有使用 Amazon Route 53 Resolver 服务器,您的自定义域名服务器必须适当地解析主机名.
  • Instances with a public IP address do not receive corresponding public DNS hostnames.
  • The Amazon Route 53 Resolver cannot resolve Amazon-provided private DNS hostnames.
  • Instances receive custom private DNS hostnames if there is a custom domain name in the DHCP options set. If you are not using the Amazon Route 53 Resolver server, your custom domain name servers must resolve the hostname as appropriate.

如果 enableDnsHostnamesenableDnsSupporttrue,则检查 DHCP 选项集是否被修改.

If enableDnsHostnames and enableDnsSupport are true then check if the DHCP option set is modified.

  • 转到 AWS 控制台中的 VPC 服务页面.选择 Your VPCs 以查看所有 VPC.
  • 选择 VPC,然后选择 ActionsEdit DHCP options set.
  • 在 DHCP 选项集列表中,选择默认的 DHCP 选项列表,然后选择保存.
  • Go to the VPC service page in the AWS Console. Select Your VPCs to see all the VPCs.
  • Select the VPC, and select Actions, Edit DHCP options set.
  • In the DHCP options set list, select the default DHCP option list, and then choose Save.

在 VPC 服务页面上,您可以找到 DHCP 选项集,您可以在其中获取默认 DHCP 选项集.

On the VPC service page, you can find the DHCP Options Sets where you can get the Default DHCP Options Sets.

正在运行的 EC2 实例需要几个小时才能反映这一点,而无需重新启动.您也可以通过以下命令更新IP租约.

It would take a couple of hours for the running EC2 instances to reflect this without a restart. You can also renew the IP lease by the following command.

  • Windows:ipconfig/renew
  • Linux:sudo dhclient -r

如果您等不及,或者重新启动实例.

Or restart the instance, if you can't wait.

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

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