MQTT broker- client connection

Hello,

Hope everyone having a great day. I'm working on an exiting project to collect data from a robot and I do experience some difficulties. Let me know your suggestions;

The robot as a client is supposed to send out data in mqtt to a broker(Node-red-aedes) which is on a windows based pc.(Both robot and pc isn't connected to internet).

And my pc has 4 network carts as shown in picture below. How can I make sure that the my aedes-node-red broker only uses 192.168.3.253??? Its only possible to configure port inside broker.

Also any recommendations for other broker which can be installed on a windows based machine?

Hi, if you forgo Node-red-aedes and install mosquitto (as a service) you will have a much better solution. Additionally, Mosquitto can be configured to bind to the ethernet IP address as you require.

Better still, this will remove a bottleneck from Node-RED and be more resilient (since Node-RED restarts and deploys will not cause the broker to drop offline)

3 Likes

Thanks a lot @Steve-Mcl . And to manipulate the IP address I think i need to go to mosquitto.conf.. isnt it?

yes

To bind Mosquitto to a specific IP address you need to modify the Mosquitto configuration file (usually named mosquitto.conf).

  1. Open the Mosquitto configuration file in a text editor. The default location is C:\ProgramData\Mosquitto)
  2. Add listener 1883 <ip-address> where <ip-address> is the IP you want to bind to
1 Like

Note though that the actual IP address you use to connect to mosquitto must be the IP address of the device running mosquitto.

1 Like

Also, don't forget to add an entry to Windows Firewall to allow port 1883 inbound access.

And note that the connection as discussed here is NOT SECURED at all. May not matter to you but you should be aware.

1 Like

Good afternoon Gents,

Scenario- Mosquitto running as a service and node-red-mqtt node as a client on same pc.

Situation1-Node is getting connected when server is configured as "localhost".
Situation 2-Node gets disconnected when I write IP address of computer on Server config.

However instead of Mosquitto as a service, when I use nodered-Aedes broker, both above situations works.
At the moment no inbound rules created on windows firewall- I suspect it as the cause.

How to find the IP which is used by Mosquitto(service on windows???

When using aedes broker- all client infos are available in debug window of nodered. Is it possible to get a log or similar info from mosquitto broker(which runs as a service)???

Thanks for any input.

It should be the IP you setup here -

By default Mosquitto only allows local connections, so if you haven't setup the listener then it will not allow a connection from another IP. Also it will only allow unauthenticated access via localhost, so you need to setup authentication, or explicitly allow anonymous connections.

If you use the IP address, you are forcing the traffic to leave the PC, go via your switch or router and then come back in, just like traffic from a different device would come in.

Using localhost or 127.0.0.1 keeps the traffic within the device and so it doesn't hit the Windows firewall and so works.

Use mosquitto and set up the inbound firewall rule.