MQTT only local working

Hi,

I have installed mosquitto on a raspberry. It looks like it working.
Domoticz sends to node red, that works.
But it is only local, and there seems to be a problem.
MQTT Explorer can’t connect.

Anybody who can help?

There is a Faillure:

pi@raspberrypi:~ $ systemctl status mosquitto.service
● mosquitto.service - Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2022-11-26 21:39:55 CET; 1min 11s ago
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Process: 6503 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 6504 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 6505 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
Process: 6506 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
Process: 6507 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
Main PID: 6507 (code=exited, status=1/FAILURE)

Nov 26 21:39:55 raspberrypi systemd[1]: mosquitto.service: Service RestartSec=100ms expired, scheduling restart.
Nov 26 21:39:55 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Nov 26 21:39:55 raspberrypi systemd[1]: Stopped Mosquitto MQTT Broker.
Nov 26 21:39:55 raspberrypi systemd[1]: mosquitto.service: Start request repeated too quickly.
Nov 26 21:39:55 raspberrypi systemd[1]: mosquitto.service: Failed with result ‘exit-code’.
Nov 26 21:39:55 raspberrypi systemd[1]: Failed to start Mosquitto MQTT Broker.

I would guess that you either have an error in your config file, or that your persistence file (if you have one) has been corrupted.

I would suggest trying to start manually to see if you get more information:

sudo /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Also, if you can only connect from the local machine but not from remote machines, then please note you have to configure a listener to allow remote access. For example /etc/mosquitto/mosquitto.conf could contain:

listener 8883
certfile <path to server cert>
keyfile <path to server private key>
allow_anonymous true

This config would allow encrypted but unauthenticated access. You should always use authentication, I would suggest using the dynamic security plugin: Dynamic Security Plugin | Eclipse Mosquitto

Regards,

Roger