mqtt / use hostname option doesn't work on LAN / Mega32

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Tommmii
Normal user
Posts: 37
Joined: 06 Apr 2018, 12:37

mqtt / use hostname option doesn't work on LAN / Mega32

#1 Post by Tommmii » 06 Apr 2018, 17:50

Build 20100 - Mega32
Build time Mar 30 2018 16:13:45
Using DHCP for networking.
My LAN has an internal DNS server, which resolves local hostnames just fine.
home.local resolves to 192.168.11.5

Setting the "use hostname" (home.local)option for OpenHAB MQTT results in faillure to connect to MQTT.
Setting the "use IP address" (192.168.11.5) option for OpenHAB MQTT results in connection to MQTT.

What am i missing ?
Last edited by Tommmii on 15 Apr 2018, 13:13, edited 1 time in total.

TD-er
Core team member
Posts: 1463
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: mqtt / use hostname option doesn't work on LAN

#2 Post by TD-er » 06 Apr 2018, 20:50

Is 'home.local' resolvable on other computers in the same network?

Tommmii
Normal user
Posts: 37
Joined: 06 Apr 2018, 12:37

Re: mqtt / use hostname option doesn't work on LAN

#3 Post by Tommmii » 07 Apr 2018, 10:57

yes it is, that's what i meant when i wrote "home.local resolves to 192.168.11.5"

I was asking in anther thread how to get the dhcp details, such as DNS server.
This is why I was asking.

However, ESP Easy is getting NTP information from the default ntp host.
So ESP Easy knows how to resolve pool.ntp.org to one of the ntp pool addresses.
But it doesn't resolve home.local to the MQTT server's address 192.168.11.5 (LAN).

Next step, set up an NTP server on the LAN, and point ESP Easy towards that hostname...

Tommmii
Normal user
Posts: 37
Joined: 06 Apr 2018, 12:37

Re: mqtt / use hostname option doesn't work on LAN

#4 Post by Tommmii » 08 Apr 2018, 12:26

I tested a LAN based NTP server , serial debug shows :

Code: Select all

NTP  : NTP send to nas.local (192.168.11.4)
NTP  : NTP replied: 11 mSec
So that works fine.

Pinging the LAN based mqtt server from another host (win pc in this ex) also works fine :

Code: Select all

Pinging home.local [192.168.11.5] with 32 bytes of data:
Reply from 192.168.11.5: bytes=32 time<1ms TTL=64
using home.local as the mqtt server works with all other devices on the lan.

using home.local with ESP Easy, serial debug shows :

Code: Select all

FILE : Saved /config.dat
FILE : Saved /config.dat
FILE : Saved /security.dat
Ram usage: Webserver only: 5340 including Core: 0
MQTT : Intentional reconnect
MQTT : Failed to connect to broker
MQTT : Intentional reconnect
MQTT : Failed to connect to broker
MQTT : Intentional reconnect
MQTT : Failed to connect to broker
niet lekker :?

TD-er
Core team member
Posts: 1463
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: mqtt / use hostname option doesn't work on LAN

#5 Post by TD-er » 08 Apr 2018, 12:37

Ha een Nederlander ;)
What is the name of the ESP device itself?
I could add the IP address of the MQTT connect attempt in the log.

Tommmii
Normal user
Posts: 37
Joined: 06 Apr 2018, 12:37

Re: mqtt / use hostname option doesn't work on LAN

#6 Post by Tommmii » 08 Apr 2018, 12:44

Vlaming, but close enough :o
the ESP32 shows up in my DHCP server leases with hostname esp3202-0

Code: Select all

Pinging esp3202-0.local [192.168.11.127] with 32 bytes of data:
Reply from 192.168.11.127: bytes=32 time=4ms TTL=255
edit :
the device is getting the correct LAN based dns server.

Code: Select all

"WiFi":{
,
"IP":"192.168.11.127",
"Subnet Mask":"255.255.255.0",
"Gateway IP":"192.168.11.1",
"MAC address":"edited",
"DNS 1":"192.168.11.2",
"DNS 2":"0.0.0.0",

Tommmii
Normal user
Posts: 37
Joined: 06 Apr 2018, 12:37

Re: mqtt / use hostname option doesn't work on LAN

#7 Post by Tommmii » 09 Apr 2018, 10:46

shamelessly bumping this... could some one at least please try it, to confirm/deny ?

TD-er
Core team member
Posts: 1463
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: mqtt / use hostname option doesn't work on LAN

#8 Post by TD-er » 14 Apr 2018, 16:36

Is the IP of DNS correct? It is often the same as the router and thus the gateway.
But here they differ.

So could you post the relevant results of "ipconfig /all" (Windows) or the route table + resolv.conf and ifconfig when using Linux on another computer?

Tommmii
Normal user
Posts: 37
Joined: 06 Apr 2018, 12:37

Re: mqtt / use hostname option doesn't work on LAN

#9 Post by Tommmii » 14 Apr 2018, 17:06

the ip's are totally correct.
I run a separate DHCP/DNS server.

Code: Select all

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : local
   Description . . . . . . . . . . . : Intel(R) 82579LM Gigabit Network Connection
   Physical Address. . . . . . . . . : 00-21-CC-redacted
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 192.168.11.135(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Saturday 14 April 2018 09:12:15
   Lease Expires . . . . . . . . . . : Sunday 15 April 2018 09:12:15
   Default Gateway . . . . . . . . . : 192.168.11.1
   DHCP Server . . . . . . . . . . . : 192.168.11.2
   DNS Servers . . . . . . . . . . . : 192.168.11.2
   NetBIOS over Tcpip. . . . . . . . : Enabled

PS C:\Users\Tom> nslookup esp3202-0.local
Server:  server.local
Address:  192.168.11.2

Name:    esp3202-0.local
Address:  192.168.11.127

PS C:\Users\Tom>

dampa
Normal user
Posts: 39
Joined: 19 Jul 2018, 01:48

Re: mqtt / use hostname option doesn't work on LAN / Mega32

#10 Post by dampa » 16 Dec 2018, 11:46

I'm having the same issue when I use the hostname it never connects.

My use case: I'm developint a plant monitoring system using a rpi zero w and Node-RED. The pi runs the mqtt broker. I have a Wemos D1 min running ESPeasy. If I specify the IP address in ESPeasy it works fine, but I want to use the Hostname so when I move this to a new network, I won't need to worry about the IP address.

Any solution to this?

dampa
Normal user
Posts: 39
Joined: 19 Jul 2018, 01:48

Re: mqtt / use hostname option doesn't work on LAN / Mega32

#11 Post by dampa » 16 Dec 2018, 12:07

Good News, I just upgraded to the ESP_Easy_mega-20181214_normal_ESP8266_4096.bin and it is now WORKING!!! :D

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests