# Unable to Connect to Mosquitto Broker

**URL:** <https://discourse.nodered.org/t/unable-to-connect-to-mosquitto-broker/38736>\
**Category:** General\
**Created:** [7 January 2021 17:46 UTC](https://discourse.nodered.org/t/unable-to-connect-to-mosquitto-broker/38736 "2021-01-07T17:46:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![quentinP](https://avatars.discourse-cdn.com/v4/letter/q/ba9def/32.png) [@quentinP](https://discourse.nodered.org/u/quentinP)\
**Post date:** [7 January 2021 17:46 UTC](https://discourse.nodered.org/t/unable-to-connect-to-mosquitto-broker/38736/1 "2021-01-07T17:46:46Z")

</div>

I'm trying to connect Node-RED (which is running on an Azure Web-App) to my mosquitto broker (v.3.1.1, which is running on and Azure Virtual Machine running Ubuntu v18.04.1). I am able to pub and sub on localhost with 2 cmd windows open. I believe localhost is on port 1883.

I've also allow acces to the 1883 port on the VM through this command

```auto
sudo ufw allow 1833

```

However, when I try to connect the node-red MQTT node (either pub or sub) it's just stuck with a little yellow square bellow and says "connecting" constantly. I'm not sure what I'm missing because I haven't even configure the SSL connection yet (I tried and failed too so I'm trying without it first). The MQTT node configuration and the server config can be seen below:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/5/65e00ed5c2c05540abf6e0aa7b84efc581a69a56.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/f/ffab96020985dcd72a7075018e749971bd7bcd88.png)

(I can only put 2 images in the post but the security contains my mosquitto username and password)

Is there something I'm missing or a way to troubleshoot this?

ps: the birth, close and will message are blank at the moment. I'm fairly new to this so apologies if the question isn't properly asked.

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [7 January 2021 19:18 UTC](https://discourse.nodered.org/t/unable-to-connect-to-mosquitto-broker/38736/2 "2021-01-07T19:18:42Z")

</div>

> [@quentinP](#):
>
> `ufw allow 1833`

I'm not an VM ware expert, but **UFW** is for setting the firewall and not opening ports.  
Google tells me you need to use something like _az vm open-port -g MyResourceGroup -n MyVm --port 80 --priority 100_

---

<div class="post-metadata">

**Author:** ![quentinP](https://avatars.discourse-cdn.com/v4/letter/q/ba9def/32.png) [@quentinP](https://discourse.nodered.org/u/quentinP)\
**Post date:** [7 January 2021 19:33 UTC](https://discourse.nodered.org/t/unable-to-connect-to-mosquitto-broker/38736/3 "2021-01-07T19:33:18Z")

</div>

Neither am I 😅 I'll look into that and see if it works. Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 January 2021 19:33 UTC](https://discourse.nodered.org/t/unable-to-connect-to-mosquitto-broker/38736/4 "2021-01-21T19:33:26Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
