# How connect MQTT on VPS to node-red

**URL:** <https://discourse.nodered.org/t/how-connect-mqtt-on-vps-to-node-red/26160>\
**Category:** Dashboard\
**Created:** [6 May 2020 10:06 UTC](https://discourse.nodered.org/t/how-connect-mqtt-on-vps-to-node-red/26160 "2020-05-06T10:06:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![power](https://avatars.discourse-cdn.com/v4/letter/p/85e7bf/32.png) [@power](https://discourse.nodered.org/u/power)\
**Post date:** [6 May 2020 10:06 UTC](https://discourse.nodered.org/t/how-connect-mqtt-on-vps-to-node-red/26160/1 "2020-05-06T10:06:29Z")

</div>

Dear all  
i have problem. I build mqtt broker on my VPS, now, i want to connect mqqt broker with node-red.  
I try with ip of VPS and port 1883. but not connect.  
Please help me. Thank all

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [6 May 2020 11:04 UTC](https://discourse.nodered.org/t/how-connect-mqtt-on-vps-to-node-red/26160/2 "2020-05-06T11:04:18Z")

</div>

Hi Power,  
Have you confirmed the following steps:

1. It can connect to mqtt through a client running on the same VPS
2. The firewall allows port 1883 through for outside traffic
3. You can connect to the mqtt broker on the VPS through a client like MQTT Explorer or similar, from a remote location

If any of those 3 steps fail, you've an issue to resolve between the broker and your VPS/networking. If these don't fail, it might be in the configuration setup. See if you can report back on those 3 steps first. I recently set up Mosquitto on a cloud server, and realised a bit too late that my connection issues were caused by not allowing access to the port beyond the own network.

---

<div class="post-metadata">

**Author:** ![power](https://avatars.discourse-cdn.com/v4/letter/p/85e7bf/32.png) [@power](https://discourse.nodered.org/u/power)\
**Post date:** [6 May 2020 14:32 UTC](https://discourse.nodered.org/t/how-connect-mqtt-on-vps-to-node-red/26160/3 "2020-05-06T14:32:36Z")

</div>

thank you answer.

1. I can sub and pub on localhost with mqtt on vps use with ssh
2. i think, i can't open

You have document for me, thanks

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [7 May 2020 00:22 UTC](https://discourse.nodered.org/t/how-connect-mqtt-on-vps-to-node-red/26160/4 "2020-05-07T00:22:05Z")

</div>

We have no idea on what VPS you are using - but would almost guarantee that it will have a firewall enabled - you will need to enable port 1883 through the firewall. I would also suggest you lock the firewall down to only allow 1883 from your remote IP address - otherwise you will very quickly find you broker under attack from outside

Craig

---

<div class="post-metadata">

**Author:** ![power](https://avatars.discourse-cdn.com/v4/letter/p/85e7bf/32.png) [@power](https://discourse.nodered.org/u/power)\
**Post date:** [7 May 2020 07:27 UTC](https://discourse.nodered.org/t/how-connect-mqtt-on-vps-to-node-red/26160/5 "2020-05-07T07:27:34Z")

</div>

wow wow wow.  
what''s happen ?. I ''m reinstall soft of VPS  
when i build mqtt broker on VPS. i dont attack open 1883 port. i can't connect it with node-red on my latop. but. i can controller lamp with mqtt broker on my VPS with soft on smart phone. yesterday i dont do it so i don''t know mqtt on VPS had active. Why ?.  
why i can not connect node-red with mqtt broker on VPS. but i can connect node-red with mqtt broker on raspberry. OMG !

---

<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:** [6 June 2020 07:27 UTC](https://discourse.nodered.org/t/how-connect-mqtt-on-vps-to-node-red/26160/6 "2020-06-06T07:27:40Z")

</div>

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