Can't connect to MQTT broker in container

Hello,

I have a remote location with LTE connection where I want to experiment with sending system stats (bandwidth usage, LTE connection data) to a local MQTT broker, so that they can be retrieved by remote scripts and pushed to Grafana. I’m running a hAP ac³ Microtik device with a 32GiB pendrive and I’ve followed instructions at Container - mosquitto MQTT server - RouterOS - MikroTik Documentation and I have the container running seemingly fine. I can subscribe to it from my laptop and publish to it from my laptop just fine.

# mosquitto_sub -h fd78:d1ba:5c3e:12fd::1001 -t test/topic
{"hello":world}
# mosquitto_pub -h fd78:d1ba:5c3e:12fd::1001 -t test/topic -m "{\"hello\":world}"

But Mikrotik itself can’t connect to the broker

[admin@mt-down-livingroom] > /iot/mqtt/brokers/print
 0 name="mosquitto" address="fd78:d1ba:5c3e:12fd::1001" port=1883 ssl=no auto-connect=yes keep-alive=60
   parallel-scripts-limit=off connected=no
[admin@mt-down-livingroom] > /log/print follow
…
2025-11-02 17:28:29 mqtt,error couldn't resolve fd78:d1ba:5c3e:12fd::1001
…

The container is configured similar as in the linked example using a bridge, and I’ve added the bridge to the LAN interface list. I can route to it from my home network, as shown in the examples above:


admin@mt-down-livingroom] > /ipv6/address/print
Flags: D - DYNAMIC; G - GLOBAL, L - LINK-LOCAL
Columns: ADDRESS, INTERFACE, ADVERTISE
 #    ADDRESS                                    INTERFACE      ADVERTISE
 0  G fd78:d1ba:5c3e:1200::1/64                  bridge         yes
…
 4  G fd78:d1ba:5c3e:12fd::1/64                  containers     yes

And I can ping it from the Mikrotik box:

[admin@mt-down-livingroom] > ping fd78:d1ba:5c3e:12fd::1001 count=1
  SEQ HOST                                     SIZE TTL TIME       STATUS
    0 fd78:d1ba:5c3e:12fd::1001                  56  64 485us      echo reply
    sent=1 received=1 packet-loss=0% min-rtt=485us avg-rtt=485us max-rtt=485us

Does the IoT package not support IPv6?

I did some experimentation a while back, and never got it to work. I did not look at the logs back then, but my conclusion was that it did not work, and I reverted to IPv4.

Well, at least the container can be made dual-stack. I don’t have Legacy IP within my network, only on its edges, so that devices like this MT box can connect over WG and provide routing to an ULA prefix. I guess I’ll make an official bug report to Mikrotik.

1 Like