Dns 设备可以';不解析主机

Dns 设备可以';不解析主机,dns,esp8266,arduino-esp8266,Dns,Esp8266,Arduino Esp8266,我的ESP8266中有一个简单的DNS解析演示。找不到为什么它会在AWS上解析Ubuntu的虚拟机。据我了解,DNS服务器是我的家庭路由器192.168.1.1。当ESP8266失败时,分辨率在我的台式电脑上正常工作。为什么以及如何解决这个问题 void printDNSServers() { Serial.print("DNS #1, #2 IP: "); WiFi.dnsIP().printTo(Serial); Serial.print(", "); WiFi.dnsIP(

我的ESP8266中有一个简单的DNS解析演示。找不到为什么它会在AWS上解析Ubuntu的虚拟机。据我了解,DNS服务器是我的家庭路由器192.168.1.1。当ESP8266失败时,分辨率在我的台式电脑上正常工作。为什么以及如何解决这个问题

void printDNSServers() {
  Serial.print("DNS #1, #2 IP: ");
  WiFi.dnsIP().printTo(Serial);
  Serial.print(", ");
  WiFi.dnsIP(1).printTo(Serial);
  Serial.println();
}

void printIPAddressOfHost(const char* host) {
  IPAddress resolvedIP;
  if (!WiFi.hostByName(host, resolvedIP)) {
    DEBUG_LOG("DNS lookup failed.  ");
    DEBUG_LOGLN(host);
  }
  DEBUG_LOGLN(host);
  DEBUG_LOGLN(" IP: ");
  Serial.println(resolvedIP);
}



void loop()
{
  printDNSServers();
  printIPAddressOfHost("yahoo.com");
  printIPAddressOfHost("ec2-34-254-225-201.eu-west-1.compute.amazonaws.com port");
}
输出为:

DNS #1, #2 IP: 192.168.1.1, (IP unset)
yahoo.com
 IP: 
98.138.219.232
DNS lookup failed.  ec2-34-254-225-201.eu-west-1.compute.amazonaws.com port
ec2-34-254-225-201.eu-west-1.compute.amazonaws.com port
 IP: 

您正在尝试解析以下主机名:

ec2-34-254-225-201.eu-west-1.compute.amazonaws.com port
由于当前字符串不是有效的主机名,因此需要将
端口
从末尾去掉

ec2-34-254-225-201.eu-west-1.compute.amazonaws.com

您使用静态IP配置还是DHCP?试试DHCPIt现在是DHCP。