So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Cool Javelon
#91251 I have a home network with router, and can access my Windows and Linux computers via their names. I do not have to remember their IP address. (IP address are in the form 192.168.1.nn).

I would like to access my ESP8266-12 (NodeMCU) in the same way.

I have created several projects, and when connecting to my WiFi, I use the following...

WiFi.hostname(our_name); // tell the router who we are
WiFi.begin(ssid, password); // start the connection

Where...

our_name

Is defined as a char[12] somewhere.

I do see the proper string in the list of computers on my router, but I cannot access the web server (in the ESP) by that name. I must enter the IP address.

Part of the problem may be that I don't totally understand how the local DNS translation works.

Can someone help me to figure this out?

Thanks, Mark.
User avatar
By solaria
#91273 Well, there's mDNS, where you would access the ESP8266 in the '.local' domain:
Code: Select allhttp://esp8266.local/

...but I've had issues with that from "Windows" computers.

I think what you want is LLMNR (Link-Local Multicast Name Resolution). It's like mDNS, but without the '.local' part. (And it works from "Windows" out-of-the-box.)
Code: Select allhttp://esp8266/


Example in ArduinoIDE->File->Examples->ESP8266LLMNR->LLMNR_Web_Server
User avatar
By Cool Javelon
#91275 I've read about mDNS, but I didn't want the .local suffix. I will look into LLMNR, Thanks solaria.

so, solaria, it that your real name, or are you an Asimov fan?

Mark.
User avatar
By solaria
#91304 Having second thoughts...

LLMNR Library is only available for ESP8266, nothing for ESP32 for example. Works fine from Windows and Ubuntu, but not Raspberry Pi OS. Oh well.

MDNS works from Ubuntu and Raspberry Pi OS, but I haven't gotten it to work yet from Windows.

Neither one works from Android. Would be nice to be able to use an Android tablet to control the IOTs.

Only things that works everywhere is local DNS running in the router. DHCP reservations put an entry into the local domain (e.g. '.home'); DNS search path includes 'search home' so that 'esp8266' is resolved by 'esp8266.home'. For example:

Code: Select all$ resolvectl query esp8266
esp8266: 192.168.1.18                         -- link: eth0
          (esp8266.home)

-- Information acquired via protocol DNS in 109.1ms.
-- Data is authenticated: no


The web browsers get confused if you just put 'esp8266' in the address bar though. It assumes that you probably want to do a Google search on 'esp8266' rather than access the web server at 'esp8266', and prints a message at the top of the window: "Did you mean to go to http://esp8266/ ?". Usually you can get around that by putting a '/' as the end of esp8266/, or just use the full name.

Depends on the router firmware I guess. Works with DD-WRT and probably OpenWRT, Tomato, ASUSWRT, etc...

--

Solaria was the programming node on my old network of Apollo Domain DN3000's; file servers were Terminus and Trantor; other nodes were Aurora, Nexon, Anacreon, etc...