curl - 亚马逊EC2实例无法解析主机

标签 curl amazon-web-services amazon-ec2 host resolve

我有一堆Amazon EC2实例。今天,我无缘无故确定其中的三个无法解析特定的网址。当我尝试curl <url>时,这三个实例都说“curl:(6)无法解析主机”,而所有其他实例都能够解析url并返回正确的数据。也只有特定的网址-所有其他网址都可以正常工作。

是什么原因造成的?我没有在任何实例上进行任何更改,所以这不是我所做的。我如何找出发生的原因?

最佳答案

检查并比较正常主机和非正常主机之间的/etc/resolv.conf(对于Linux实例)。这是我的Linux实例的信息:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.0.0.2
search us-west-2.compute.internal

如果是Windows实例,请检查并比较ipconfig /all命令的输出,以查看正常主机和非正常主机之间的DNS条目。这是我的Windows实例的信息:
Windows IP Configuration

   Host Name . . . . . . . . . . . . : WIN-************
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : us-west-2.ec2-utilities.amazonaws.com
                                       ec2.internal
                                       us-east-1.ec2-utilities.amazonaws.com
                                       compute-1.internal
                                       us-west-2.compute.internal

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . : us-west-2.compute.internal
   Description . . . . . . . . . . . : Citrix PV Ethernet Adapter #0
   Physical Address. . . . . . . . . : 02-E6-AB-83-C6-8A
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 10.0.0.251(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Friday, March 21, 2014 11:36:17 AM
   Lease Expires . . . . . . . . . . : Tuesday, March 25, 2014 5:07:59 AM
   Default Gateway . . . . . . . . . : 10.0.0.1
   DHCP Server . . . . . . . . . . . : 10.0.0.1
   DNS Servers . . . . . . . . . . . : 10.0.0.2
   NetBIOS over Tcpip. . . . . . . . : Disabled

关于curl - 亚马逊EC2实例无法解析主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22614374/

相关文章:

ios - Amazon AWS S3 从 iOS 设备上传

amazon-web-services - 使用 Cloudformation 针对 Kinesis Firehose 的 AWS Put 订阅筛选器 - 检查给定的 Firehose 流是否处于 ACTIVE 状态

node.js - 在 Nodejs 中以编程方式连接到 Mongodb Amazon EC2 实例

java - 请问如何将此 Curl 请求移植到 Android?

ssl - 尝试访问我网站的 XML 文件时出现 cURL 60 错误

PHP Curl 图片上传

ruby-on-rails - 使用 curl 模拟带有嵌套资源数组的表单发布

javascript - Ng-model 直到点击页面上的某个地方才显示更新的值

mysql - Laravel 5.3 不在 AWS EC2 Ubuntu 16.04 中发送电子邮件

linux - 为 Ubuntu 定义一个设置 key 文件,以便在通过 SSH 连接到服务器时使用