MQTT to external server from inside Home Assistant - not working

HI,
have installed Home Assistant app into a TrueNAS Scale 25.04.2.1.
I was trying to connect Home Assistant on my OwnTracks external server over MQTT.
My TrueNAS server is running at home. From inside my home network I was able to connect to the MQTT Server where OwnTracks is running too, using

mosquitto_sub

Everytime I start installing MQTT device into HA, using the same settings and credentials as in the mosquitto_sub command, I get this error

Logger: paho.mqtt.client
Quelle: /usr/local/lib/python3.13/site-packages/paho/mqtt/client.py:3259
Erstmals aufgetreten: 13:29:28 (2 Vorkommnisse)
Zuletzt protokolliert: 14:18:57

failed to receive on socket: [Errno 104] Connection reset by peer

bug or feature ?
Thanks

Best run HAOS in a VM instead of the app. This is the way recommended by the Home Assistant project.

Done. Same in the VM. No connection.
But thanks Patrick

I gave up with HA as a container. I now run it on its own seperate Odroid (at least I think thats what it was)

Maybe you need to setup a network bridge?

I run mine in a container with a MACVLAN but it’s not for everyone


1759517665: New connection from 80.139.100.xxx:61223 on port 8883.
1759517665: OpenSSL Error[0]: error:0A00010B:SSL routines::wrong version number
1759517665: Client <unknown> disconnected: Protocol error.

setting the broker to listen on 1883 = workaround.