How to link WiFi Hotspot from two containers?

I am trying to link a WiFi hotspot from one container to another.

I enabled a WiFi hotspot with dbus from my Network Manager container that is going to be receiving video streams over RTSP. After connecting my camera to the hotspot, another container (Nimble Agent) can not see that ip. How do I link the wlan0 interface between the services?

Thank you in advance

Hi there, you will need to make sure the IP subnet where your wireless clients are can be reached by the other container. Are you able to reach the client IP from the NM container and if so, what does the routing table look like for both containers?

Hi, thank you for your response.

I can not from the NM container, you can’t if ping is forced from eth0

These are the routes from NM:

default via dev eth0 metric 100 dev wlan0 scope link src metric 600 dev balena0 scope link src dev resin-dns scope link src dev supervisor0 scope link src dev resin-vpn scope link src dev br-4bcae92b28f8 scope link src dev br-20f64b98bb95 scope link src dev eth0 scope link src metric 100

and here are the routes from Nimble: dev eth1 proto kernel scope link src dev eth0 proto kernel scope link src

How do I make the IP subnet reachable from the other container?

Hi there,

From the routes you shared I imagine you are using network_mode: host on your NetworkManager container, whereas your Nimble container is using a bridged network, thus it cannot reach the interfaces on the host. The solution would be to set network_mode: host on your Nimble container and then both containers will be able to communicate.

Please let us know if that works for you.

Otherwise if you don’t want to do that you could maybe tell us more about the reasons the application you are trying to setup. It may be sufficient to expose a port from the Nimble container to have external hosts to reach it

We would prefer to not set Nimble as host to make sure some of our ports are not exposed.

Preferably we would like to link traffic from eth0 → wlan0 and then the camera stream should be accessible.

Could you provide more details on how the different elements interact? Where is the camera server? On the device or on another host? Why does the Nimble container need to access the NetworkManager service?

To clarify on my previous answer, the Nimble container should be able to access external network addresses and external hosts should be able to access the exposed ports by the Nimble container, so you only need to set network_mode: host if you want direct communication between the containers.

Thanks again for your help

Previously we had our devices connected to a network via ethernet that also has multiple ip cameras connected to it. Then, our device could access the streams from those other cameras. Now, we are trying to connect to a WiFi doorbell. Our current process is to enable a WiFi hotspot in the NM and then have the doorbell connect to it. This should allow us to access the stream from Nimble but it is not working at the moment. The network manager is responsible for managing the network interfaces and creating the hotspot. The nimble agent service is used for all video processing (streaming and recording). This interface is fully functional with any wired camera but it currently not seeing the WiFi doorbell.

I see, I think you should be able to access the from the Nimble container since the NetworkManager container sets the network configuration host wide. Can you ping the WiFi doorbell IP address from your Nimble container? How about the NetworkManager container? Can you ping from the Nimble container?

From the Network Manger container I can ping the doorbell from only the wlan0 interface

From the Nimble container I can not ping the doorbell. I get the following response:

PING ( 56(84) bytes of data.
From icmp_seq=1 Destination Port Unreachable

I can however ping the hotspot ( from the nimble container

Hi, can you check if you’re able to reach the camera ip from the hostOS? One easy way to do this would be to run the Nimble container with network_mode: host as well. This way we can rule out that it’s something related to container networking…

Another thing to look at would be the iptables setup. Can you provide the input chain setup of your device?

You are able to connect to the camera from the initial container you use for setting up the hotspot?

I am able to ping the camera from the hostOS. Also here are the iptables I have set up to try and make a NAT between the eth0 and wlan0 interface:

Screen Shot 2021-02-16 at 9.07.19 AM

Hi, were you able to solve the issue? I read the thread, but the network topology you have there is not very clearly explained. I see you are adding iptable rules between wlan0 and eth0. Are you trying to connect one device that is on eth0 to another one that is an access point client on wlan0 through the main balena device above? Please provide as much information as possible, so that I may give you some guidance on how to approach this.


1 Like


I was able to solve my problem by refactoring the Nimble container so it can be on Host. The issue has been resolved. Thank you for your help

Glad that did work for you in the end, and thanks for letting us know. :slight_smile: