How to impliment DNS in AP mode?

lalitahuja33
Posts: 4
Joined: Wed Jul 22, 2020 1:03 pm

How to impliment DNS in AP mode?

Postby lalitahuja33 » Tue Jul 28, 2020 5:08 pm

  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);

Agree007
Posts: 70
Joined: Mon Sep 18, 2017 7:11 pm
Location: Copenhagen

Re: How to impliment DNS in AP mode?

Postby Agree007 » 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.

lalitahuja33
Posts: 4
Joined: Wed Jul 22, 2020 1:03 pm

Re: How to impliment DNS in AP mode?

Postby lalitahuja33 » Wed Jul 29, 2020 3:14 pm

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?

Who is online

Users browsing this forum: No registered users and 28 guests