nopnop2002 / esp-idf-mdns

Example of IP address resolution using mDNS
MIT License
5 stars 1 forks source link

mdns not working properly #2

Open ravikorde opened 1 month ago

ravikorde commented 1 month ago

Hi Team, I am using hardware ESP32C6 chip using wifi for internet connectivity

working scenario:

  1. on starting we are geeting dhcp wifi ip address
  2. we are initialise mdns
  3. we are able to login by using dns name

not working scenario:

  1. when we try to switch from dhcp to static ip (we give static ip configuration from web page and restart esp device)
  2. after restart we are init mdns
  3. we are getting ip and we can able to ping that ip even we can able to access web page by using ip address but only issue is we are not able to access web page by using mdns name till 10 minutes
  4. after 10 minutes it will start
  5. so please help on it how it will reflect mdns name without delay

note:why it will take 10 minutes to update mdns name with new ip address?

nopnop2002 commented 1 month ago

If you use a fixed IP, you will need to stop and re-register the DNS server.

Here is a sample.

https://github.com/nopnop2002/esp-idf-ftp-camera/blob/master/main/main.c#L181

korderavi commented 1 month ago

thanks for reply i have already did what you have suggested

here is how i have did wifi_init(); netbiosns_stop(); mdns_service_remove("_http", "_tcp"); mdns_stop();

mdns_free();
initialise_mdns();
netbiosns_init();
netbiosns_set_name(DnsHostname);
nopnop2002 commented 1 month ago

why it will take 10 minutes to update mdns name with new ip address?

I don't know for sure, but it might be a problem with updating the routing table on the host side.

Please check the routing table on the host side.

korderavi commented 1 month ago

Can you help me on this then

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: nopnop2002 @.> Sent: Tuesday, August 6, 2024 3:49:31 PM To: nopnop2002/esp-idf-mdns @.> Cc: Ravi Korde @.>; Comment @.> Subject: Re: [nopnop2002/esp-idf-mdns] mdns not working properly (Issue #2)

[CAUTION: This email has originated from outside your organization. Please verify the sender and safety of contents before clicking on the link(s) or opening attachment(s), if any.]

I don't know for sure, but it might be a problem with updating the routing table on the host side.

Please check the routing table on the host side.

— Reply to this email directly, view it on GitHubhttps://github.com/nopnop2002/esp-idf-mdns/issues/2#issuecomment-2270923625, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BETI5SDXM2OGKPORG7EV5BLZQCPLHAVCNFSM6AAAAABMAIBWAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZQHEZDGNRSGU. You are receiving this because you commented.Message ID: @.***>

nopnop2002 commented 1 month ago

I don't know much about it.

You probably need to clear the mDNS cache, but I don't know how.

You can use these command to resolving mDNS

$ sudo apt install avahi-utils

$ avahi-resolve -n esp32-mdns1.local
esp32-mdns1.local       192.168.10.115

$ avahi-browse -art
= enp2s0 IPv4 ESP32 with mDNS                               _service_49876._udp  local
   hostname = [esp32-mdns-05C634.local]
   address = [192.168.10.115]
   port = [49876]
   txt = []