Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up MQTT_SN gateway failed #26

Open
Pawlicho opened this issue Oct 24, 2023 · 7 comments
Open

Setting up MQTT_SN gateway failed #26

Pawlicho opened this issue Oct 24, 2023 · 7 comments

Comments

@Pawlicho
Copy link

Hi there,

I am trying to setup Thread network with MQTT-SN over it and I came across your docker for paho. I've been trying to follow instructions provided here https://github.com/kyberpunk/openthread/blob/master/README.md#Trying-MQTT-SN-client-with-CLI-application-example, however I fail at the step when I want to run MQTT_SN Gateway docker. I correctly run OTBR through docker and started mosquitto docker as 172.18.0.8. When I run the command:
sudo docker run --name paho --net test --ip 172.18.0.8 kyberpunk/paho --broker-name 172.18.0.7 --broker-port 1883
I receive the error:
exec /app/paho/MQTTSNGateway/docker_entrypoint.sh: exec format error

If i decide to choose binding to container:otbr I am not able to specify neither broker port nor ip address.

I have been trying to use gateway from official paho repository, but I am struggling to understand: To connect to a gateway through a client I need its ip address, but I can see only multicast adresses to configure in .conf file.

I'd appreciate help from you. I would not bother but it's crucial for my studies.

@kyberpunk
Copy link
Owner

kyberpunk commented Oct 25, 2023

Hi @Pawlicho , thank you for noticing. there was a bug in entrypoint script which is fixed now. kyberpunk/paho-mqtt-sn-docker@f38feb7. I will also release new docker images (1.0.3).
My entrypoint script doesn't provide much configuration options, but you can easily override whole configuration file as described here: https://github.com/kyberpunk/paho-mqtt-sn-docker/blob/master/README.md?plain=1#L49

You can use default configuration as a base, I personally use these configuration options to bind directly to OTBR interface:

# UDP6
GatewayUDP6Bind=::1
GatewayUDP6Port=10000
GatewayUDP6Broadcast=ff03::1
GatewayUDP6If=wpan0

kyberpunk referenced this issue in kyberpunk/paho-mqtt-sn-docker Oct 25, 2023
@kyberpunk
Copy link
Owner

Also please try this image instead, paho6 repository is not maintained, now it is under one: https://hub.docker.com/layers/kyberpunk/paho/udp6/images/sha256-a83b84a08593ca2be6e8b40aad0683c824747ee4260f599a36b130ff50f914c6?context=repo

@Pawlicho
Copy link
Author

Pawlicho commented Oct 25, 2023

Hi @kyberpunk,
Firstly, I'd like to thank you for very quick response, it means a lot to me.

I am not sure if I do something wrong, but running both kyberpunk/paho:latest and kyberpunk/paho:1.0.3-udp6 results in error:
exec /app/paho/MQTTSNGateway/docker_entrypoint.sh: no such file or directory
Is it possible file has changed location or name and fails to be executed?

I also would like to ask about thos configurations you quoted:
UDP6 GatewayUDP6Bind=::1 GatewayUDP6Port=10000 GatewayUDP6Broadcast=ff03::1 GatewayUDP6If=wpan0

Should they be appended to the .conf file? I am asking because in default configuration file provided on official paho repo there are only set those parameters:
UDP6 | DTLS6 GatewayIPv6PortNo=10000 MulticastIPv6PortNo=1883 MulticastIPv6=ff1e:feed:caca:dead::1 MulticastIPv6If=wlp4s0 MulticastHops=1

Thank you for your time!

@kyberpunk
Copy link
Owner

kyberpunk commented Oct 26, 2023

@Pawlicho you are right, I see, they have changed these options: eclipse-paho/paho.mqtt-sn.embedded-c@5fb4312. So it may look this way, I will test it myself in the evening:

GatewayIPv6PortNo=10000
MulticastIPv6PortNo=1883
MulticastIPv6=ff03::1
MulticastIPv6If=wpan0

About that error, I accidentally built docker images on windows with CRLF endings, I've uploaded new fixed artifacts. Sorry for that.

@Pawlicho
Copy link
Author

Pawlicho commented Oct 26, 2023

Thank you @kyberpunk. Just one more question (may seem stupid): if I'd like to connect the client to the gateway with which IP address should I open socket? Should it be some multicast ip like ff03::1 / ff02::1 or mesh-local EID or maybe some other? I mean in case I ran docker in container:otbr network.

@kyberpunk
Copy link
Owner

@Pawlicho I'm not sure if I get the question correctly. Do you use OpenThread CLI example app or do you have some other client?
MulticastIPv6If=wpan0 means that Gateway will bind to wpan0 interface and will listen on the same IP as is the OTBR IP address. MulticastIPv6 is just good for sending advertisements. In CLI client you should connect to IPv6:LocalAddress of OTBR (mqtt connect <IPv6:LocalAddress> 10000), it can be found on OTBR web page -> Status.
If you are using some other client you may listen on all addresses [::].

@Pawlicho
Copy link
Author

@kyberpunk I am very sorry to disturb you again. Running kyberpunk/paho:udp6 results in such output:
`-VirtualBox:~$ sudo docker run --name paho --net container:otbr kyberpunk/paho:udp6 --broker-name 172.18.07 --broker-port 188
--broker-name
--broker-port
sed: can't create temp file '/etc/paho/gateway.confXXXXXX': Permission denied
sed: can't create temp file '/etc/paho/gateway.confXXXXXX': Permission denied



ConfigFile : /etc/paho/gateway.conf
ClientList : /path/to/your_clients.conf
Broker : mqtt.eclipseprojects.io : 1883, 8883
RootCApath : (null)
RootCAfile : (null)
CertKey : (null)
PrivateKey : (null)
SensorN/W : Multicast Address: [ff1e:feed:caca:dead::1]:1883, Gateway Port:10000, Interface: wlp4s0, Hops:1
Max Clients : 30

20231029 192743.028 PahoGateway-01 starts running.
`
It seems like setting opionts does not work.
What I meant in previous comment was that: I want to write a client that connects to mqtt-sn gateway over openthread. Zephyr mqtt-sn api rquires to specify mqtt-sn gateway structure address (port + ip). However, I have a problem with previous steps. I even tried to run mosquitto and paho apps without docker on localaddress. Should mosquitto log whether paho gateway established a connection?

Last question wouldn't it be enaugh to have just a gateway without a broker?

A lot of prabably stupid questions, but I have been struggling for days. Time files but I need it for my reasearch and I am pretty desperate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants