arduino / ArduinoCore-mbed

316 stars 188 forks source link

`Ethernet.dnsServerIP()` does not return the IP address I set with `Ethernet.begin()` #916

Open haveyouseenf opened 2 days ago

haveyouseenf commented 2 days ago

While working with the Ethernet library on my Opta I stumbled upon this weird behavior. You can easily reproduce the issue with the following sketch:

#include <Ethernet.h>

IPAddress ip(192, 168, 10, 15);
IPAddress subnet(255, 255, 255, 0);
IPAddress dns(1, 1, 1, 1);
IPAddress gateway(192, 168, 10, 1);

void setup() {
  Serial.begin(9600);

  Ethernet.begin(ip, dns, gateway, subnet);

  Serial.print("IP = ");
  Serial.print(Ethernet.localIP());
  Serial.print(", DNS server = ");
  Serial.print(Ethernet.dnsServerIP());
  Serial.print(", Default gateway = ");
  Serial.println(Ethernet.gatewayIP());
}

void loop() {
}

On the serial monitor I get the following output:

IP = 192.168.10.15, DNS server = 8.8.8.8, Default gateway = 192.168.10.1

For some reason the DNS server always returns 8.8.8.8. If I can provide further details let me know!

JAndrassy commented 2 days ago

what version of the Arduino Mbed platform do you have installed?

haveyouseenf commented 2 days ago

I'm using mbed_opta version 4.1.3.