Hi, all
Try to use the function to resolve IP address from domain names, it works fine when IP setting is configured as DHCP, however when it is configured as STATIC, it doesn't work. It seems use DHCP server as DNS server.
I run lwip on bare metal - not sure there is any alternative function.
Any suggestion?
Thanks!
Ping
Hi @ping1 :
Under the DHCP mode, the DNS server is configured correctly by the DHCP server.
With static mode, you need to set the right DNS server by yourself. You should be very careful. Maybe that is the reason.
void | dns_setserver (u8_t numdns, const ip_addr_t *dnsserver) |
Regards
Daniel
Hi, Daniel
Thanks for reply, you are right that DNS server is handled by DHCP server in DHCP mode.
I just wonder how to get it work in static situation, if it needs DNS server IP address , is there a way to tell the LWIP? will it still work? Any examples?
Thanks
Ping
Hi @ping1 :
First you need to know the right DNS server in your network, for example, 1.1.1.1
Please refer to below code.
#include "lwip/dns.h" ip_addr_t dnsServerIp; IP_ADDR4( &dnsServerIp, "1.1.1.1"); dns_setserver(0, &dnsServerIp);
Regards
Daniel