Connecting to RabbitMq (3.7.4) Mqtt broker remotely

836 views
Skip to first unread message

Sachin Deshpande

unread,
Mar 29, 2018, 8:38:37 AM3/29/18
to rabbitmq-users
Hello All, 

I am new to rabbitmq. I have installed rabbitmq v 3.7.4 on my Ubuntu machine. I have also enabled the mqtt plugin. I am unable to connect the mqtt client to the Rabbitmq broker

I want to connect mqtt client to the Rabbitmq MQTT broker. Client and RabbitMQ server are in same domain. I am using MQTT.fx as client. I get Connection timeout error and unable to connect. With MQTT.fx client I can connect to mosquitto mqtt broker installed on different machine.

Following are the changes I have done for adding the user as per www.rabbitmq.com/mqtt.html#config

1) created the user using the Management UI
       user : mqtt-guest
       Password : mqtt-guest

2)  User has all the permission
 Virtual host , Configure regexp   Write regexp  Read regexp
   /                    .*                             .*                    .*

3) Topic Permission
 Virtual host , Exchange      Write regexp  Read regexp
   /                    amq.topic        ^mqtt- .*         ^mqtt- .*

4) Tags: administrator
  
5) I tried with 1883 and 5672 ports for connection in both the cases it fails.

Can you please tell me where I am going wrong and how do I resolve the issue ?

Thanks 
Sachin





Luke Bakken

unread,
Mar 29, 2018, 9:54:40 AM3/29/18
to rabbitmq-users
Hi Sachin,

The RabbitMQ team has a network troubleshooting guide you should follow - https://www.rabbitmq.com/troubleshooting-networking.html

On your RabbitMQ server, you should confirm that port 1883 and 5672 are being listened on interfaces reachable by your client. In this case, 0.0.0.0 means all interfaces:

$ ss -pln | egrep '1883|5672'
tcp  LISTEN 0  128    0.0.0.0:25672    0.0.0.0:*    users:(("beam.smp",pid=12472,fd=60))
tcp  LISTEN 0  128    0.0.0.0:15672    0.0.0.0:*    users:(("beam.smp",pid=12472,fd=74))
tcp  LISTEN 0  128          *:5672           *:*    users:(("beam.smp",pid=12472,fd=71))
tcp  LISTEN 0  128          *:1883           *:*    users:(("beam.smp",pid=12472,fd=72))

If that is the case, follow the troubleshooting guide to verify connectivity from your client machine to the one running RabbitMQ using telnet, nc or similar command that will open a socket connection to port 1883.

Thanks,
Luke

Sachin Deshpande

unread,
Mar 30, 2018, 2:27:00 AM3/30/18
to rabbitm...@googlegroups.com
Hello Luke, 

Thanks for the reply. My output of command is as follows

tcp    LISTEN     0      128                    *:15672                 *:*      users:(("beam.smp",2648,72))
tcp    LISTEN     0      128                    *:25672                 *:*      users:(("beam.smp",2648,58))
tcp    LISTEN     0      128                   :::1883                 :::*      users:(("beam.smp",2648,71))
tcp    LISTEN     0      128                   :::5672                 :::*      users:(("beam.smp",2648,70))

one thing I observed that with lsof command I can see that rabbitMq is listening on port 1883 for ipV6 but in case of ipv4 it is not giving any output

root@tmt01-a:~# sudo lsof -n -i4TCP:1883 | grep LISTEN
root@tmt01-a:~# 
root@tmt01-a:~# 
root@tmt01-a:~# sudo lsof -n -i6TCP:1883 | grep LISTEN
beam.smp 2648 rabbitmq   71u  IPv6  16689      0t0  TCP *:1883 (LISTEN)
root@tmt01-a:~# 

Does that mean that it is listen only on IPv6 and not on IpV4 ?

Thanks
Sachin





--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sachin Deshpande

unread,
Mar 30, 2018, 4:37:52 AM3/30/18
to rabbitmq-users
Hello All, 

I am able to connect to the RabbitMq. I guess the port were not open but one thing is not clear regarding the command 

root@tmt01-a:~# sudo lsof -n -i6TCP:1883 | grep LISTEN
beam.smp 2648 rabbitmq   71u  IPv6  16689      0t0  TCP *:1883 (LISTEN)

This shows that only IPV6 address can listen to 1883 port ?

Thanks, 
Sachin

On Friday, March 30, 2018 at 11:57:00 AM UTC+5:30, Sachin Deshpande wrote:
Hello Luke, 

Thanks for the reply. My output of command is as follows

tcp    LISTEN     0      128                    *:15672                 *:*      users:(("beam.smp",2648,72))
tcp    LISTEN     0      128                    *:25672                 *:*      users:(("beam.smp",2648,58))
tcp    LISTEN     0      128                   :::1883                 :::*      users:(("beam.smp",2648,71))
tcp    LISTEN     0      128                   :::5672                 :::*      users:(("beam.smp",2648,70))

one thing I observed that with lsof command I can see that rabbitMq is listening on port 1883 for ipV6 but in case of ipv4 it is not giving any output

root@tmt01-a:~# sudo lsof -n -i4TCP:1883 | grep LISTEN
root@tmt01-a:~# 
root@tmt01-a:~# 
root@tmt01-a:~# sudo lsof -n -i6TCP:1883 | grep LISTEN
beam.smp 2648 rabbitmq   71u  IPv6  16689      0t0  TCP *:1883 (LISTEN)
root@tmt01-a:~# 

Does that mean that it is listen only on IPv6 and not on IpV4 ?

Thanks
Sachin




On Thu, Mar 29, 2018 at 7:24 PM,
Hi Sachin,

Michael Klishin

unread,
Mar 30, 2018, 9:38:38 AM3/30/18
to rabbitm...@googlegroups.com
By default RabbitMQ will bind to all available interfaces. You can limit it to only some
interfaces if needed.


To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Luke Bakken

unread,
Mar 30, 2018, 10:02:48 AM3/30/18
to rabbitmq-users
Hi Sachin,

This is due to how Linux maps IPv4 addresses when IPv6 is enabled. Every IPv4 address is a valid IPv6 address, so the output will show that IPv6 is being listened to:


Luke
Reply all
Reply to author
Forward
0 new messages