Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Basic configuration issue with multiple listeners

Hello Peter,

 

It is my understanding that a listener is associated with a port.

 

I think that you are truing to assign port 1883 to local and internet connections Which is why you are getting the error on daemon startup.

 

There are a couple of ways to address the issue.

  1. Use different ports and ip address (listener / port combo) for internet and local
    1. Listener 1883 ipaddr/localhost
    2. Listener 1885 ipaddr/internet facing
  2. Use default port 1883 with no IP Address (listener) which will allow internet and local  devices to connect
  3. If there is a firewall / router facing the internet, setup a forwarding rule to redirect internet devices to come on 1883 but port forwarded to second listener

 

Please note one you have made the changes, you need to stop the mosquito process and restart it. Just restarting the process does not help.

 

One way to verify it is to run the following command

 

sudo netstat -tulpn

 

it should give you an output like this.

 

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 172.20.20.11:1883       0.0.0.0:*               LISTEN      1006/mosquitto

tcp        0      0 172.20.20.11:1885       0.0.0.0:*               LISTEN      1006/mosquitto

 

 

More details are this url

https://mosquitto.org/man/mosquitto-conf-5.html

 

I hope this helps.

 

Thanks

 

Anil

 

Sent from Mail for Windows 10

 


From: mosquitto-dev-bounces@xxxxxxxxxxx <mosquitto-dev-bounces@xxxxxxxxxxx> on behalf of Peter Rockett <p.rockett@xxxxxxxxxxxxxxx>
Sent: Wednesday, August 7, 2019 3:11:46 PM
To: mosquitto-dev@xxxxxxxxxxx <mosquitto-dev@xxxxxxxxxxx>
Subject: [mosquitto-dev] Basic configuration issue with multiple listeners
 
Hi

I have a rather basic mosquitto configuration issue that I am going round in circles with... I clearly have some fundamental misunderstanding  that I would grateful if someone could sort out.

For the time being I am ignoring encryption - that's for later. So everything on port 1883 for now.

I can get mosquitto to work fine with a single (default) listener. So "port 1883" + "bind_interface localhost" = no problem. Testing with mosquitto_sub/pub allows me to exchange messages perfectly. Alternatively, just omitting all port/bind_interface/listener directives works, presumably due to the default listener starting.

But anything involving "listener" seems to give me a "Connection refused" error with mosquitto_sub . So omitting "bind_interface" but adding "listener 1883" or "listener 1883 localhost" with or without "port 1883" gives me the same "Connection refused " error. I can see from the log that I am also getting an error on daemon startup saying "Error: Address already in use".

What fundamental thing am I missing? I ask because eventually I want to create two listeners, one bound to localhost and a second to a network card with a static IP address out to a wireless access point, and then ignore MQTT traffic on the main, public internet-connected network. I then want to add encryption to (at least) the wireless connection. But since I am stumbling on two unencrypted connections...

On Linux Mint 19.

Peter

Back to the top