MQTT EMQX Hassio "Failed to connect"

Hi everyone,

I have a fresh Home-Assistant installation and try to connect it to my MQTT Broker.
My Broker is a EMQX Docker Container on Unraid, Hassio is a VM on the same Unraid Server. Host Access to Custom Networks is enabled in Unraid.

EMQX Version: 5.1.5
Hassio Version: 2023.8.2
Supervisor: 2023.08.1
Operating System: 10.4
Frontend: 20230802.0 - latest

Hassio has a different IP on the same Network Interface as the Docker Container, which is bridged with all the relevant ports forwarded.

In EMQX I set the authentication to clientid and password.

When I try to connect hassio to EMQX with the MQTT Integration, I get a “Failed to connect” error, without any further explanation.

If I look in the EMQX logs it looks like the authentication went through:

2023-08-14T07:25:33.352967175Z 2023-08-14T09:25:33.352699+02:00 [debug] msg: raw_bin_received, mfa: emqx_connection:when_bytes_in/3, line: 779, peername: 192.168.xxx.xxx:41109, bin: <<redacted>>, size: 50, type: hex
2023-08-14T07:25:33.352988946Z 2023-08-14T09:25:33.352865+02:00 [debug] msg: mqtt_packet_received, mfa: emqx_channel:handle_in/2, line: 335, peername: 192.168.xxx.xxx:41109, clientid: hassio, packet: CONNECT(Q0, R0, D0, ClientId=hassio, ProtoName=MQTT, ProtoVsn=4, CleanStart=true, KeepAlive=60, Username=hassio, Password=******), tag: MQTT
2023-08-14T07:25:33.353142914Z 2023-08-14T09:25:33.352978+02:00 [debug] msg: authenticator_result, mfa: emqx_authentication:authenticate_with_provider/2, line: 699, peername: 192.168.xxx.xxx:41109, clientid: hassio, authenticator: <<"password_based:built_in_database">>, result: {ok,#{is_superuser => true}}, tag: AUTHN
2023-08-14T07:25:33.353178209Z 2023-08-14T09:25:33.353075+02:00 [debug] msg: authentication_result, mfa: emqx_authentication:authenticate/2, line: 247, peername: 192.168.xxx.xxx:41109, clientid: hassio, reason: chain_result, result: {stop,{ok,#{is_superuser => true}}}, tag: AUTHN
2023-08-14T07:25:33.353457209Z 2023-08-14T09:25:33.353305+02:00 [debug] msg: insert_channel_info, mfa: emqx_cm:insert_channel_info/3, line: 159, peername: 192.168.xxx.xxx:41109, clientid: hassio
2023-08-14T07:25:33.353466507Z 2023-08-14T09:25:33.353370+02:00 [debug] msg: mqtt_packet_sent, mfa: emqx_connection:serialize_and_inc_stats_fun/1, line: 878, peername: 192.168.xxx.xxx:41109, clientid: hassio, packet: CONNACK(Q0, R0, D0, AckFlags=0, ReasonCode=0), tag: MQTT
2023-08-14T07:25:33.353547514Z 2023-08-14T09:25:33.353462+02:00 [debug] msg: emqx_connection_terminated, mfa: emqx_connection:terminate/2, line: 669, peername: 192.168.xxx.xxx:41109, clientid: hassio, reason: {shutdown,tcp_closed}, tag: SOCKET
2023-08-14T07:25:33.353605334Z 2023-08-14T09:25:33.353524+02:00 [info] msg: terminate, mfa: emqx_connection:terminate/2, line: 674, peername: 192.168.xxx.xxx:41109, clientid: hassio, reason: {shutdown,tcp_closed}

The hassio logs are here:

2023-08-14 09:25:33.353 DEBUG (Thread-3 (_thread_main)) [paho.mqtt.client] Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'hassio'
2023-08-14 09:25:33.560 ERROR (Thread-3 (_thread_main)) [paho.mqtt.client] failed to receive on socket: [Errno 104] Connection reset by peer

Here are the settings for the MQTT Integration:

To troubleshoot it a bit I added a Ping Sensor in Hassio, which pings the EMQX IP and it stays connected all the time, so there shouldn’t be a network issue (as the EMQX log may show, too).

Since there are already multiple shellies and a zigbee2mqtt-container connected to EMQX I think the configuration is fine.

Has anyone any idea why hassio refuses to connect to my EMQX Broker?

Thanks!