Search code examples
mqttipv6mosquitto

Mosquitto_sub Error : connection refused, IPv6 only


I'm trying to communicate between my Ubuntu and raspberry pi3 by subscribing and publishing mosquitto using IPv6. I disabled IPv4 and am trying to subscribe using the command below:

mosquitto_sub -h raspberrypi -p 1883 -v -t "test"

The response:

Error: Connection refused

my mosquitto conf:

id_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

#allow_anonymous false
listener 1883
socket_domain ipv6
#listener 1883 fe80::b497:9600:80bf:a56e

I have no experience with MQTT protocol, could you help me with this issue? Thanks in advance.


Solution

  • As hashed out in the comments

    To use a link-local ipv6 address you must include the interface identifier on the end of the address.

    mosquitto_sub -h "fe80::b497:9600:80bf:a45e%enp0s25" -p 1883 -v -t "test"