Page 1 of 1

How to impliment DNS in AP mode?

Posted: Tue Jul 28, 2020 5:08 pm
by lalitahuja33
  1. I'm trying to impliment DNS in the AP mode. The code is working fine with the local Ip which is 192.168.1.1
  2. What changes needs to done to make it work?
  3. error: implicit declaration of function 'dns_local_addhost'
  1. tcpip_adapter_ip_info_t ipInfo;
  2.     tcpip_adapter_dns_info_t dns_info;
  3.     ip_addr_t dnsip;
  4.     dnsip.type = IPADDR_TYPE_V4;
  5.     IP4_ADDR(&dnsip.u_addr.ip4, 192,168,1,1);
  6.     IP4_ADDR(&ipInfo.ip, 192,168,1,1);                 
  7.     IP4_ADDR(&ipInfo.ip, 192,168,1,1);                         
  8.     IP4_ADDR(&ipInfo.gw, 192,168,1,1);                 
  9.     IP4_ADDR(&ipInfo.netmask, 255,255,255,0);              
  10.     IP4_ADDR(&dns_info.ip.u_addr.ip4, 192,168,1,1);            
  11.     tcpip_adapter_init();
  12.     tcpip_adapter_dhcps_stop(TCPIP_ADAPTER_IF_AP);
  13.     tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_AP, &ipInfo);
  14.     tcpip_adapter_set_dns_info(TCPIP_ADAPTER_IF_AP, TCPIP_ADAPTER_DNS_MAIN, &dns_info) ;
  15.     dns_init();
  16.     dns_local_addhost("www.mylocalserver.com",&dnsip);
  17.     tcpip_adapter_dhcps_start(TCPIP_ADAPTER_IF_AP);

Re: How to impliment DNS in AP mode?

Posted: Wed Jul 29, 2020 11:12 am
by Agree007
Do you have s DNS server connected to the AP ?

If not you need to add one or write a DNS server code for the esp32.

Re: How to impliment DNS in AP mode?

Posted: Wed Jul 29, 2020 3:14 pm
by lalitahuja33
Agree007 wrote:
Wed Jul 29, 2020 11:12 am
Do you have s DNS server connected to the AP ?

If not you need to add one or write a DNS server code for the esp32.
  1. Can you please tell me how to do that?