2

I've set up an ESP8266 (Wemos D1 Mini) to get IP-information via DHCP. Everything works fine and I can print the information :

Serial.print(WiFi.macAddress()); Serial.print(WiFI.localIP()); Serial.print(WiFi.subnetMask()); Serial.print(WiFi.gateway.IP());

But how do I print the DNS-address ??

I cant find a function for this ???

/Kind regards : Gurra

asked May 1, 2019 at 9:11
1

1 Answer 1

5
Serial.println(WiFi.dnsIP());

If you have more than one DNS server you can specify the index:

Serial.println(WiFi.dnsIP(1));
answered May 1, 2019 at 9:15
2
  • 1
    Thanks Majenko, i've Googled this question and found answers to ip, netmask, mac & gateway but not DNS, so you saved me hours of extra work by this....So I am very grateful !! Commented May 1, 2019 at 10:49
  • 1
    You're welcome. You can find all the functions in the ESP8266WiFiSTA.h header file. Commented May 1, 2019 at 10:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.