I may have missed some API ... but is there a way to specify the DNS servers that our ESP32 should use when it connects as a station? Where do the DNS server lists come from when we connect to an access point? Is it perhaps received as part of the DHCP protocols? What if we aren't using DHCP but instead configuring static IP addresses or simply want to specify our own DNS server names?
DNS is the Domain Name System which is the technology responsible for resolving character based domain names (eg. www.google.com) into their corresponding IP addresses.
Setting DNS servers ...
Setting DNS servers ...
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
-
- Posts: 3
- Joined: Mon Feb 29, 2016 2:38 am
Re: Setting DNS servers ...
I am also interested about this. I have tried to use: without success. I also experience that whenever a static IP is configured, the ESP32 cannot access the internet anymore (although it is reachable on my local network). Anybody has ideas on this?
Cheers,
Daniel
Code: Select all
dns_setserver()
Cheers,
Daniel
Re: Setting DNS servers ...
Well this is how dhcp does it:
Code: Select all
/* DNS servers */
for (n = 0; (n < DNS_MAX_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n); n++) {
ip_addr_t dns_addr;
ip_addr_set_ip4_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n)));
dns_setserver(n, &dns_addr);
}
Who is online
Users browsing this forum: No registered users and 93 guests