I’m trying to make my raspberry pi act as a router by spinning up a container. I have 2 wifi interfaces (wlan0, wlan1), wlan0 to be connected to my home network and wlan1 to be made an access point. I’m using the hostapd with dnsmasq (added ‘bind-interfaces’) and port forwarding to bring up a container in the pi. When I push the code to the device via resin, an access point is created on wlan1 and then the device goes offline when it tries to start the dnsmasq. I used this code for a demo, the device went offline after starting up an access point. Is there a way to make this use case work? and was there any steps given in the documentation that I missed? Appreciate any reply. Thanks!
Hi, which version of resinOS are you using?
It should be different for resinOS 1.x and 2.x, will ask the project creator , but on 2.x it should be even simpler, using NetworkManager. If that’s your case, you can look around for resources on that (access point creation with NM), and we’ll have more info when the resinOS version used is know.
We use Network Manager in resinOS2.x to manage the devices connections. Network Manager supports both creating access points and automatically bridging the connection between multiple interfaces.
Just drop the below example configuration into a file inside the
/boot/system-connections directory on the SD card and name it
resin-hotspot, next use the Network Manager DBUS API to enable the connection called
You will then be able to connect to the hotspot using
resin-hotspot as both the SSID and password.
As a bonus this hotspot method automatically bridges the connection!
[connection] id=resin-hotspot uuid=36060c57-aebd-4ccf-aba4-ef75121b5f77 type=wifi autoconnect=false interface-name=wlan1 permissions= secondaries= [wifi] band=bg mac-address-blacklist= mac-address-randomization=0 mode=ap seen-bssids= ssid=resin-hotspot [wifi-security] group= key-mgmt=wpa-psk pairwise= proto= psk=resin-hotspot [ipv4] dns-search= method=shared [ipv6] addr-gen-mode=stable-privacy dns-search= method=auto
Thanks for the reply!
I tried doing the mentioned procedure but I’m unable to resolve my problem. Maybe I’m doing it wrong.
I have included a resin-hotspot file in /boot/system-connections directory on the SD card replacing with the current device’s uuid.
I’m trying to use the Network Manager DBUS API to enable resin-hotspot. But I’m getting the following hex values while trying to get the available connections in python terminal.
and while trying to use the example python program activate_connection.py given with the source code, I’m getting the following,
Can you kindly direct me to the correct procedure for using the Network Manager DBUS API. Thanks!
It looks like your wireless interface is not named correctly or is already in use.
Please can you burn a
dev image, copy the connection file onto the SD card as you did before and connect to the host OS (more info here)
Once you have connected to the host OS please run
nmcli c and
nmcli d posting the output here.
Update to this thead available here with a similar issue - Creating access point - Raspberry Pi Zero W
Thanks for this, it solves exactly the problem I am up against.
I would like to know, however, if there is a more programatic way of going about this. Perhaps a technique that allows for this same configuration to be affected across a fleet of devices using the platform rather than editing the system-connections folder on the SD card?
Also, FWIW, my interface name was wlan0 on my rpi 3 and use of the interface required
nmcli con down resin-wifi-01 prior to
nmcli con up resin-hotspot else I received a contention error.
Yes, you can use the NetworkManager D-Bus API to create an access point. This is how our WiFi Connect project creates its captive portal access point: https://github.com/resin-io-modules/network-manager/blob/e8457f4d82334d3ade271995a6df725ada746b8e/src/dbus_nm.rs#L274
Additionally you will probably need to run application like dnsmasq for the DHCP and DNS server part you need.
You may also use hostapd for creating an access point from inside of your container. Here is an example for this: https://github.com/resin-io-playground/hostapd-minimal
We are currently working on improving on this in our OS - we will have a separate service with nice API for doing this type of networking configuration, but we are still in an initial implementation phase.
It really all depends on the of purpose your access point. If you provide a bit more information on this I can provide you with more specific recommendations.