We have Fin’s running multiple containers. One of them we have set up as an access point for devices to connect to.
Currently it does not provide internet access to anything connected to it. The Fin itself has internet (either via ethernet or 3/4G modem) - could someone point us in the right direction (or give us the entire solution at once, that’d be nice) for information about what we need to do to get this AP providing internet connectivity to its connected devices.
In the ipv4 section of your NetworkManager AP connection profile you need to set the method property to shared. This will set everything up for you including launching dnsmasq as a DHCP server.
Our AP is already up and running using hostapd and dnsmasq all kicked off and controlled with some python scripts (the usage of the AP is fairly specific and we need to integrate with the AP handles and whatnot).
So, we have the hotspot portion of the functionality down and working but we need to bridge (or something) the hotspot interface (wlan0) to … x… that provides connected devices with internet access.
I think that your solution might cause conflicts with that, unless I’m mistaken?
In addition to the usual rules you may need to add something specific to our OS - iptables -P FORWARD ACCEPT.
Depending on the use-case you may either go with pure NetworkManager supported solution like the first one I described, or if you have to parametrize more settings then you may do the custom hostapd/dnsmasq solution. NetworkManager under the hood also uses those, however it does not allow so much parametrization, although it should be sufficient for the majority of the use-cases.
Is there a clean way to set up a wifi access point (hotspot) from a container during runtime? I followed some of the examples that use Python NetworkManager but after the creation of the wifi access point from within a container, two dnsmasq processed in the host start to show high CPU usage (some sort of race condition) once a device logs into the access point.
If I understand this correctly, the example https://www.balena.io/docs/reference/OS/network/2.x/#creating-a-hotspot explains how a hotspot can be setup by mounting the balenaOS file system and modifying files that are copied during boot. It does not, however, help if a hotspot needs to be created during runtime. Is that correct?
Hey, did you use the dbus method for creating the hotspot or by putting the files in root?
As an aside I’ve had success using nmcli from within my container (and using the io.balena.features.dbus label to use the host dbus) to do this exact thing at runtime.