This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can't connect MQTT-subscriber to MQTT-broker running on RaspberryPi3

I can connect the board to the Pi and ping it with a globally valid IPv6.

When trying to connect with the MQTT broker, however, no package is sent from the Chip to the Pi.
After many tests in debugging mode I found out, which probably prevents sending the package:

(mqtt_transport_lwip.c: line 297)
err_t err = tcp_connect((struct tcp_pcb *)p_client->tcp_id, (ip_addr_t *)&p_client->broker_addr, p_client->broker_port, tcp_connection_callback);

The function returns "FFFFFFFC"

If my researches are correct, then this means that the nRF52 first requires a RouterAdvertisementMessage from a globally valid IPv6 address, which it does not receive according to my Wireshark analysis.
If so, how can I get the BT0 interface on the Pi, to do that? It only transmits with the link local IPv6 though it also has a global one.
Or am I completely on the wrong track?

Here my radvd.conf:

interface eth0
{
AdvSendAdvert on;
prefix fd00:b::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr on;
};
route ::/0
{
};
};

interface bt0
{
AdvSendAdvert on;
prefix fd00:a::/64
{
AdvOnLink off;
AdvAutonomous on;
AdvRouterAddr on;
};
};

I'm running the "iot_mqtt_lwip_subscriber"-example from the SDK15 on nRF52840

I followed the instructions on this two pages, to configure the Raspberry:

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.iotsdk.v0.9.0%2Fiot_sdk_user_guides_radvd.html

http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.iotsdk.v0.9.0%2Fiot_sdk_user_guides_radvd.html&cp=6_1_0_2_3_2&anchor=iot_sdk_radvd_alternatives.

Parents
  • Hi,

     

    (int)0xFFFFFFFC = -4, which is:

    /** Routing problem. */
    ERR_RTE = -4,
     
     
    Are you running the mqtt broker on the RPi3? If yes, which interface is it binding to? I still suspect this issue is related to the routing on the RPi.
    Did you run "sudo route -A inet6 add <insert prefix>/64 dev bt0" ?
     
    Since you are running with a fairly new kernel, did you set sdk_config.h::BLE_6LOWPAN_LEGACY_MODE to '0'? I suspect that you did this, as ping is working. Just need to verify.
     
    Cheers,
    Håkon
  • Hi,

    you're right, I set BLE_6LOWPAN_LEGACY_MODE to 0 in the sdk.config

    I did not ran "sudo route -A inet6 add <insert prefix>/64 dev bt0". What do I have to use for <insert prefix>?

    This brings me to a new question:
    Which ip address do I have to enter in the program code for the broker, with the setup from above?

    I have no experience with IPv6 over BLE routing and I can not find much information about it. The few instructions in the forums also contradict each other.
    So I'm sure there's a misstake in my configuration. The mqtt-subscriber example needs a global IPv6 as broker-address, right?

    My broker is running on eth0, and now I see, that my eth0 has no global IPv6 with the current configuration.
    But  if I assign this to him, what will the 6to4 bring me?

    Is there no complete guide to this?

    Best regards,
    M. Uhlig

  • Routing in IPv6 is not an easy topic, as you need to have a lot of knowledge about how both IPv6 works, and how networks work. What you are doing here is that you are making a router for bluetooth IPSP devices, and there is no automated process / script that performs all this for you, so it has to be manually set up.

    There's many ways to solve this, but you normally need to match everything up to your own network, and posts from other users might not match your specific setup, so taking their interface names and prefixes directly might give a conflict on your system. My recommendation is to start small, set up things locally on the RPi, then gradually expand piece-by-piece. Save commands that you use to setup the environment in a document or script.

    If your prefix is 2002::/64 (which it seems it is at your end), you write: sudo route -A inet6 add 2002::/64 dev bt0.

    This should make the interface accessible between other interfaces.

    In terms of the broker address set in firmware, this should match your broker address. If you have set up mosquitto on your RPi, it should point to the global IP you have on your eth0 (or wlan0). For simplicity, assign short IPs to your interfaces, like 2002::1, 2002::2 etc.

    Cheers,

    Håkon

Reply
  • Routing in IPv6 is not an easy topic, as you need to have a lot of knowledge about how both IPv6 works, and how networks work. What you are doing here is that you are making a router for bluetooth IPSP devices, and there is no automated process / script that performs all this for you, so it has to be manually set up.

    There's many ways to solve this, but you normally need to match everything up to your own network, and posts from other users might not match your specific setup, so taking their interface names and prefixes directly might give a conflict on your system. My recommendation is to start small, set up things locally on the RPi, then gradually expand piece-by-piece. Save commands that you use to setup the environment in a document or script.

    If your prefix is 2002::/64 (which it seems it is at your end), you write: sudo route -A inet6 add 2002::/64 dev bt0.

    This should make the interface accessible between other interfaces.

    In terms of the broker address set in firmware, this should match your broker address. If you have set up mosquitto on your RPi, it should point to the global IP you have on your eth0 (or wlan0). For simplicity, assign short IPs to your interfaces, like 2002::1, 2002::2 etc.

    Cheers,

    Håkon

Children
Related