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.
I’m using Resin OS 2.0.6+rev3.
I have created a dummy repo for the code here. Please take a look at it. Thanks!
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.
Hi there guys (@josephroberts , @majorz ),
I know that this is an old topic but right now WiFi Connect (rust version) got my attention for the past months and been trying to figure out how do I add a new feature to it.
Ideal scenario: The users connects to the WiFi Access Point (Captive Portal), after the user gets successfully connected to the Access Point and specified the desired WiFi & Password then a callback URL (as a redirect should be prompted / redirected).
Useful scenario: Using WiFi Connect within in one of my IoT projects and would like to pass along the device id of the IoT device to a mobile app using custom uri schemes (something like: customapp://device-id-123-321-123-321). So after configuring the IoT device from the mobile phone and have the app installed with the custom uri scheme then to open and pass my device id to the mobile application.
Been studying the diagram flow and would like to address a question how this might be possible and if you could help me with pointing / providing some code snippets would mean huge help!
I will highlight below where I would like to intervene with the URL callback:
My question(s) stands for:
Can I somehow add a RedirectMiddleware after the local wifi connection gets successfully connected to the internet and redirect to my custom URL ?
Can I extend the waiting time of the /connect in order that the stop captive portal does not gets called before getting the response from the
let mut chain = Chain::new(assets); chain.link(Write::<RequestSharedState>::both(request_state)); chain.link_after(RedirectMiddleware); chain.link_around(cors_middleware);
Any input would be highly appreciate to find a viable solutions as soon as possible!
@elsevero could you please confirm if this is working? I remember that you mentioned that you successfully made it happen, is that correct? Thanks
Hi @mpous ,
I have solved by using the docker image of wifi connect and overriding the ui part only.
The approach with a callback URL of the captive portal is not working due to mobile operating system limitations.
My final solution was to search within the sub net local network for a specific port that a microservice has opened and connecting from mobile app using socket to that port.
Hope it helps.