# Second Pi won't connect to MQTT on First Pi

**URL:** https://discourse.nodered.org/t/second-pi-wont-connect-to-mqtt-on-first-pi/69674
**Category:** General
**Created:** [27 October 2022 13:06 UTC](https://discourse.nodered.org/t/second-pi-wont-connect-to-mqtt-on-first-pi/69674 "2022-10-27T13:06:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)
#### Post date: [27 October 2022 13:06 UTC](https://discourse.nodered.org/t/second-pi-wont-connect-to-mqtt-on-first-pi/69674/1 "2022-10-27T13:06:59Z")

</div>

I have two Pi's, one as MQTT broker.  
This can connect MQTT-out just fine, with MQTT server set to localhost, or IP address

On Pi2, I cannot get the node-red MQTT-in node to connect to Pi1

What have I missed here?

Thank you

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [27 October 2022 13:26 UTC](https://discourse.nodered.org/t/second-pi-wont-connect-to-mqtt-on-first-pi/69674/2 "2022-10-27T13:26:00Z")

</div>

Have you configured mosquitto (assuming you are using mosquitto) to allow network connections? If not then create a file in /etc/mosquitto/conf.d/ called, for example `mossy.conf` (anything.conf will do) and in there put

```auto
# allow network access without a password
listener 1883
allow_anonymous true

# human readable timestamps in log
log_timestamp true
log_timestamp_format %Y-%m-%d %H:%M:%S

```

The timestamp bit is not essential, but tells mosquitto to put readable timestamps in its log. Then restart mosquitto  
`sudo systemctl restart mosquitto`

---

<div class="post-metadata">

### Author: ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)
#### Post date: [27 October 2022 13:53 UTC](https://discourse.nodered.org/t/second-pi-wont-connect-to-mqtt-on-first-pi/69674/3 "2022-10-27T13:53:38Z")

</div>

> [@Colin](#):
>
> Have you configured mosquitto (assuming you are using mosquitto) to allow network connections?

That's done it, thank you.

---

<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: [10 November 2022 13:53 UTC](https://discourse.nodered.org/t/second-pi-wont-connect-to-mqtt-on-first-pi/69674/4 "2022-11-10T13:53:51Z")

</div>

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