Here is a test program I wrote for someone else in the forum:
void setup() {
Serial.begin(9600);
}
void loop() {
uint32_t ip_addr = 0;
char hostname[] = "www.google.com"; //your host name here!
unsigned long tic = millis();
int16_t retval = gethostbyname(hostname, strlen(hostname), &ip_addr);
unsigned long toc = millis();
IPAddress resolvedIP(BYTE_N(ip_addr, 3), BYTE_N(ip_addr, 2), BYTE_N(ip_addr, 1), BYTE_N(ip_addr, 0));
Serial.println(resolvedIP);
Serial.println(retval);
Serial.println(toc-tic);
delay(5000);
}
If that fails, maybe you could try this alternate DNS library created by @Hootie81
He had trouble with a slow link that the core’s DNS would always timeout on.