Setup: I have a Linux Laptop (Ubuntu Mate 20.04) running a Mosquitto broker and I am trying to subscribe from a raspberry pi which is inside my home network. I can publish and subscribe to the broker from my laptop, but not from the outside (other devices in my home network).
I have a config file under /etc/mosquitto/conf.d/ including:
listener 1883
allow_anonymous true
as it is recommended here https://stackoverflow.com/a/65278769.
Still it is not working and when I subscribe to a topic i am not receiving any messages. There is no error either. I appreciate any ideas how I can fix that.
To publish I use the command
mosquitto_pub -h localhost -t "test/message" -m "message here"
and for subscribing mosquitto_sub -h localhost -t "test/message"
and it is working inside the Linux Laptop itself as you can see here:
When I try to subscribe from the raspberry pi:
mosquitto_sub -h 192.168.1.103 -t "test/message"
Error: No route to host
These are the devices in my network with IPs:
Enabling the firewall and allowing port 1883 for TCP is not working. Same with disabling firewall completely.