MQTT-SN and IPv6

1,096 views
Skip to first unread message

Adam Renner

unread,
Feb 13, 2014, 1:50:51 PM2/13/14
to mq...@googlegroups.com
I have been trying to get MQTT-SN to work using IPv6 and UDP along with both the new RSMB broker and ruby-em-mqtts. I would like to get this working on Contiki-OS 6LoWPAN nodes.  I have gotten things to work using a NAT64 gateway, but would prefer not to do this. Has anyone successfully demonstrated and IPv6 + MQTT-SN implementation?
Thanks,
AR

Nicholas Humfrey

unread,
Feb 13, 2014, 5:12:25 PM2/13/14
to mq...@googlegroups.com
Hello Adam,

I am very interested in both IPv6 and MQTT-SN but have never tried both
together.
I would hope that ruby support IPv6 out of the box with ruby-em-mqtts,
but maybe there is something I need to do.

I have never tried IPv6 with RSMB broker either. Would be interesting
to try IPv6 multicast for broker discovery.

What problems did you experience?


nick.

Ian Craggs

unread,
Feb 14, 2014, 7:01:36 PM2/14/14
to mq...@googlegroups.com
I've used RSMB with ipv6 with MQTT and TCP/IP, but don't remember trying it with UDP and MQTT-SN, so it's quite likely there's a bug or two.  Which I would be happy to look into :-)

Ian

Adam Renner

unread,
Feb 14, 2014, 10:50:03 PM2/14/14
to mq...@googlegroups.com
I believe that I found that the eventmachine library did not support IPv6.

In the case of RSMB I recieved a "port unreachable" ICMP response. Thanks for your contributions Nick and Ian. I am also finding the mqtt-sn-tools very useful as well.

--adam

Adam Renner

unread,
May 10, 2014, 3:06:57 PM5/10/14
to mq...@googlegroups.com

Hello Ian,
I was curious if you had a chance to look into this further, but I thought that I would provide you with an update. I began looking at the RSMB code and found that I simply did not understand how to configure the system to turn on ipv6. I expected it to be enabled by default like mosquitto.

So I was able to open up the port by changing my config file to include this:
*********************************
listener 1884 INADDR_ANY mqtts                   
  ipv6 true
***********************************
So things are progressing but still some big issues.
I currently run a sensor simulation that connects over RSMB successfully using a NAT64 gateway.
If I attempt to run the same simulation with direct ipv6 connections, then I am not receiving a CONACK. When sniffing with wireshark, I am not even observing RSMB attempting to send out the connack.

Here is a snippet showing what is reporting on a connection attempt:
**************************************
20140510 203501.578 4 0:0:aaaa::e9:91a4:1884  <- MQTT-S CONNECT cleansession: 1
20140510 203501.578 CWNAN0075W Socket error 22 (Invalid argument) in sendto for socket 4
20140510 203501.578 134517232 0:0:aaaa::e9:91a4:1884 sensor -> MQTT-S CONNACK returncode 0 (-1)
20140510 203501.578 CWNAN0000I Client connected to udp port 1884 from sensor (0:0:aaaa::e9:91a4:1884)
**************************************
The first thing that seems blatantly mis-reported is the ip address of the sensor "(0:0:aaaa::e9:91a4:1884)". The actual ip address of the sensor is aaaa::212:7402:2:202. 1884 is the port number so it is weird that RSMB has it showing up at the end of the sensor ip address.
The broker is running on aaaa::1 and routing is configured correctly. Pings and other things are routed correctly.
There is no route for 0:0:aaaa::, so no surprise that wireshark would not detect the connack if it is attempted.

--Adam

Ian Craggs

unread,
May 11, 2014, 5:52:27 PM5/11/14
to mq...@googlegroups.com
Hi Adam,

I haven't had chance to look at it yet.  I'll do so as soon as I can.  The reason I didn't enable ipv6 by default is that when I did, all the ip addresses in messages were printed in ipv6 format,  which I didn't think was good for those who were working in ipv4 mode, which I assumed to be most people.  It was a several years ago that I implemented all of this, so it'll take me a little time to refresh my memory!

Ian

Ian Craggs

unread,
May 13, 2014, 6:20:54 AM5/13/14
to mq...@googlegroups.com
The code for sending MQTT-SN replies is not handling IPv6, basically.  I'm looking into fixing it.

Ian

Ian Craggs

unread,
May 13, 2014, 9:56:24 AM5/13/14
to mq...@googlegroups.com
Adam,

I've fixed RSMB for sending of MQTT-SN packets over IPv6 now, at least on Linux (hopefully on Windows, I haven't tried it yet).  The bug report is https://bugs.eclipse.org/bugs/show_bug.cgi?id=434748, changes in the master branch.  I'd like to know if this works for you.

You might also be interested in my half completed embedded MQTT-SN C library too: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt-sn.embedded-c.git/.  I intend to complete the first layer soon.


Ian

On Saturday, 10 May 2014 20:06:57 UTC+1, Adam Renner wrote:

Adam Renner

unread,
May 13, 2014, 12:26:05 PM5/13/14
to mq...@googlegroups.com
Ian,

Thanks! that was fast. You normally pay extra for that kind of service.
I will try to test the broker within the next few days.

Also, you and Nick may find this interesting, but I noticed yesterday that Google Summer of Code has a couple of MQTT related projects, one of which will be another MQTT-SN implementation:
https://www.google-melange.com/gsoc/project/details/google/gsoc2014/ldmitrowski/5724160613416960

--Adam

Adam Renner

unread,
May 13, 2014, 2:08:52 PM5/13/14
to mq...@googlegroups.com
Tested and working. Thanks again for making those changes.
--Adam
Reply all
Reply to author
Forward
0 new messages