Integration/mqtt error message: "dial tcp x.x.x.x/1883 connection refused"

Hi! I’m trying to connect a ChirpStack v3 gateway-bridge RAK2287+Raspberry Pi 3+ based, but when trying to connect to a ChirpStack Network Server in a certain IP address, log reports “integration/mqtt connection error” “Network Error dial tcp x.x.x.x:1883 connection refused”

I’ve already tried to check Mosquitto status in both instances, which are active.

My MQTT integration section in chirpstack-application-server.toml is default (with CA certs) and chirpstack-gateway-bridge.toml server is my instance address via 1883 port.

Mqtt + ca cert. Then should be port 8883.

Use telnet to check if port 1883 and 8883 are accessible outside the mqtt server.

I’ve already gave permissions to both ports, 1883 and 8883. However, when trying telnet, the result is unreachable for both.

Then it is the issue of MQTT.

You’re right. My issue is that I need Mosquitto to listen on a certain IP different from localhost, but seems like I’m not able to handle it yet.

To allow remote access
sudo vim /etc/mosquitto/mosquitto.conf

To add at the end
listener 1883

Yes! I finally managed to do so. I’m sorry for my unawareness, I’m kind of noob here.

In case someone is having the same issues as I was, here is how I finally solved it:

After adding rule listener <IP Address> 1883 to my mosquitto.conf file, authentication was needed due to listener.conf file and acl_file were automatically created in conf.d sub-directory. I knew about it by checking my mosquitto log. In case you don’t know where is it, check mosquitto.conf file (log_dest file <path> variable).

Then I deleted both listener.conf and acl_file and added allow_anonymous true rule to conf file

Now it works perfectly. You can manage to check that by subscribing to a topic and publish a message related to that topic. To do so:

mosquitto_sub -d -h <IP Address> -p 1883 -t "mqtt-test"

In another tab

mosquitto_pub -d -h <IP Address> -p 1883 -t "mqtt-test" -m "MQTT Broker working as expected" 

Hope it helps someone else and I didn’t made huge mistakes in my explanation.

1 Like