eclipse-mosquitto / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
9.12k stars 2.41k forks source link

How can I connect an IOT device to a Local MQTT Server? #3094

Closed Ridyu closed 3 months ago

Ridyu commented 3 months ago

(Refer url: https://github.com/eclipse/mosquitto/issues/3093)

I am implementing communication using local MQTT. By the method mentioned above, some device(Iot Machine) were able to access the address 'hostname.local' from an external device. I created a Local MQTT server under the same conditions, but there are servers that can be accessed from outside and those that cannot

They also allowed both inbound and outbound ports on the firewall. (about port 1883) In addition, both 'listener 1883' and 'allow_anonymous true' in the mosquitto.conf file were set. And run mqtt successfully using cmd. However, although it was possible on a specific pc, the iot device could not access the Local MQTT server generated by another pc. What kind of settings should I set aside?

1

image image image

The screenshot below means that an IOT device communicates with the Local MQTT Server on a specific PC (Host: hostname.local / Port: 1883) image 스크린샷 2024-08-06 145613 This is the [mosquitto.conf] File I set. What more should I set? mosquitto.zip

Daedaluz commented 3 months ago

I have a hard time deciphering what the issue is; But assuming it's about the fact that only some clients can connect; *.local domains might be looked up via MDNS; perhaps your device doesn't resolve addresses via MDNS.

Previous issue you mentioned that all are on the same net, is this still the case?

If the issue is that the server is moved, and clients cannot connect to the new server, perhaps that machine isn't advertising it's presence or is on a different net.

Best solution is probably to just use a proper DNS server.

Ridyu commented 3 months ago

@Daedaluz, Thank you for your quick response.

The condition is that the Mosquito settings on the two different PCs are the same. In the case of 'PC' A, IoT equipment is connected to Local MQTT to communicate, but in the case of 'PC' B, IoT equipment can not connected to Local MQTT server.

그림1

I used the same IoT equipment. Of course, I have reboot my PC after setting the hostname of my PC properly. Is there a setting I don't know to access mosquitoes using hostname.local address?

Daedaluz commented 3 months ago

Both windows machines? I'm not a frequent windows user, but see if network discovery is tured off somehow. Unfortunately I do not know the location of this specific setting.

I don't think this issue is related to mosquitto specifically.

Ridyu commented 3 months ago

Yes. Both Windows machines. I see. Thank you for your answer.

Daedaluz commented 3 months ago

Please close if nothing else.