Setting up a resin hotspot on RPi

Hello

I tried setting up my resin RPi (latest resin os, configured to work as ethernet only from resin.io) following these instructions:
https://docs.resin.io/reference/resinOS/network/2.x/#creating-a-hotspot

Running nmcli c, the hotspot connection doesn’t show up, it seems my resin-hotspot file is completely ignored.

Thanks

Hi nikost,

Did you put the resin-hotspot file in “/mnt/boot/system-connections/” folder?

Also, a reboot is needed for the configuration file to be available to NetworkManager.

Regards!

I am also having trouble setting up a hotspot: read the same documentation, added the balena-hotspot in resin-boot/system-connections/balena-hotspot. Nothing happened - no hotspot to be seen.

After a bit of googling stumbled upon nmcli. Not sure any more what I actually did and in what order, but got the hotspot working.

Then I tried to recreate the situation from the start, but now I am in a situation where

  • file my-hotspot in /mnt/boot/system-connections/ is not being picked up after reboot
  • previously set up connection balena-hotspot is being resurrected after reboot?? but it is not active

First:

Then shut down, check on my desktop machine that there is no balena-hotspot on the card, reboot and


(oh dammit, new users can post only one image…consider lifting that maybe?)

What is going on here? I have granted Balena staff access for 1 week.

Some additional notes:

@tkurki Hi, can you please send me a dashboard link to the device you have an issue with so that I can take a look? I saw you granted access already in your message

In a PM message, sorry did not mentioned that.

How? I don’t see the button in your profile popup like I am used to in another Discourse instance.

Heya ! The forum software sometimes disallows messaging for new members, sorry about that. I will DM you so that you can respond there. thanks !

I got a PM and responded several times, but so far nothing in reply to my messages.

Not very encouraging for somebody like me evaluating Balena for commercial use.

Very sorry about missing your message, it looks like my colleague did not see your PM. We are discussing internally on how to improve on that front.

You may find information on how the different system-connections folders are treated in our OS right after the example code in this section. Any files defined in the system-connections folder in the boot partition are always copied on boot to the folder located in the state partition. Also all nmcli operations operate over the folder in the state partition and if you delete a connection profile with nmcli, it will only delete it on the state partition (and it will be copied over once you reboot the device).

I checked our hotspot example and it looks like the hotspot is not activated automatically because of the autoconnect=false setting. If you remove it (or set it to true), the hotspot will be activated automatically.

If you need to share Internet connection over the hotspot then you may add in your hotspot connection profile:

[ipv4]
method=shared

If you just need to enable DHCP (without Internet sharing), so that other devices may get an IP address when connected to the hotspot, you may run dnsmasq from a container with a config like:

interface=wlan0

address=/#/192.168.42.1
dhcp-range=192.168.42.2,192.168.42.254
dhcp-option=option:router,192.168.42.1

bind-interfaces 
except-interface=lo 
no-hosts

And you will also have to assign the same IP through the hotspot connection profile:

[ipv4]
address1=192.168.42.1/24

@tkurki Also please check our WiFi Connect project to see if it aligns with your use case:

Thanks for the reply, things make a lot more sense now.

I had missed the explanation of the system-connections copying logic because it is under Changing the Network at Runtime which I was not trying to do. To me it would make more sense in the introduction, right after The system-connections directory consists….

Also the hotspot example that is not really functional does not make sense to me. Like, why not add the information that you provided here to the Networking document?

And consider my earlier update suggestions in this thread.

All of that is valuable feedback and I added corresponding issues for each of the items you raised.

resin-net-config mentioned in the README.ignore is not the one from the resin-net-config repo you mentioned, but is an OS service: https://github.com/balena-os/meta-balena/tree/master/meta-resin-common/recipes-connectivity/resin-net-config/resin-net-config. I marked the repo for deprecation and added a meta-balena issue for this. I filed a docs note for all other items as well.

Hello,

I’m trying to configure a hotspot with the description in the docs and the information I found here in this thread.

The hotspot pops up as expected and I can log in with the wifi password I used in the config.
I’m running a container (in a multi container setup) with dnsmasq installed and the following config borrowed from above:

interface=wlan0

address=/#/192.168.0.1
dhcp-range=192.168.0.2,192.168.0.254
dhcp-option=option:router,192.168.0.1

bind-interfaces 
except-interface=lo
no-hosts

All of this seems to work, because I actually get an ip address after log in.

Unfortunately I get kicked out of the hotspot after a very short time, beeing prompted again for the password. Why could that be?

I have two more files in my wifi config that open up connections to local wifis with internet access if they are available.
The device is a raspberry pi 3 with an external wifi dongle plugged in (edimax).

The Dockerfile for my dnsmasq service looks like this:

FROM balenalib/raspberrypi3-debian

RUN apt-get update && apt-get install -y dnsmasq && \
  apt-get clean && rm -rf /var/lib/apt/lists/*

COPY dnsmasq.conf /etc/dnsmasq.conf

Ok, I invested a little bit further and the problem might be that the hotspot is started on the edimax stick, instead of the built in chip.
How can I force wlan0 to always be the onboard broadcom chip and wlan1 the external usb?
Isn’t that what debian stretch solved with predictable network interface names? How is this done on balenaOS?

Hi
I agree that the allocation of network interface names should be predictable and not change between boots on balena.
To make sure this is the case your setup please provide me with the version of balenaOS you are using.
Regards
Thomas

Hi,
I’m using balenaOS 2.29.2+rev1 (development).

I got the hotspot working now, although setting the static ip did not work.
I set it up from inside the host OS using nmcli directly.
I also bound my external wifi setup to the mac address of my edimax stick.

Unfortunately this is not a very good solution when I have to set up a lot of those devices and maybe even automate the process. Is there any way to tell beforehand what logical interface the external usb stick will be assigned?
The best scenario would be for me to copy just two files into the system-connections folder and have the device ready to go. But for that I would really need to be sure that the hotspot will start on the internal chip and the external wifi on the usb dongle.

Hi
there are ways to get around this, e.g. setting udev rules in config.json or in a container, that will assign network interface addresses to your devices. To assess which is the best solution for your problem we need to know what exactly you are running and what you are running it on.
What exactly did you use to set up the hotspot ? You are referring to methods further up in this thread so it is not quite clear how you are doing it currently.

If you grant support access to the device we can take a look at the device directly. Please notify us if you would like to do that. We will send you a PM which you can then answer with the device ID.

Regards
Thomas

Hi
there are ways to get around this, e.g. setting udev rules in config.json or in a container, that will assign network interface addresses to your devices. To assess which is the best solution for your problem we need to know what exactly you are running and what you are running it on.
What exactly did you use to set up the hotspot ? You are referring to methods further up in this thread so it is not quite clear how you are doing it currently.
If you grant support access to the device we can take a look at the device directly. Please notify us if you would like to do that. We will send you a PM which you can then answer with the device ID.
Regards
Thomas

I made the Hotspot working and can now access the Internet that is connected to eth0 via wlan0. is there a way to prevent the access to the devices in the net of eth0? actually I can access the router and all the devices via wlan0. Would be great for security reasons. I have googled for hours for a solution with NetworkManager but without success .

Thanks for the help!