OpenWrt Docker Wifi interface

Hey,

I am just new into OpenWRT. I am planning to use it on my Raspberry Pi which is running as my home server. It runs everything in Docker. I want to use OpenWRT as a separate Wifi network.

Searching did not result in the solution of my issue:
I managed to run OpenWRT successfully in Docker on my Raspberry Pi 4. At the network interfaces tab it shows me eth0 as the WAN. Now, I want to add a new network interface, the Wifi antenna. However, the wlan0 as well as the wlan1 interface do not show up as a usable device. So, my question is; does anyone have experience in running the setup I am planning to use? And, how do you pass through these wlan adapters into Docker?

I have checked whether the interfaces are in 'state' up with ip link show and this is confirmed. Somehow, the passthrough does not occur automatically. I am running Docker containers with Docker Compose. Maybe I need to adjust some settings here. Is anyone aware of this?

My startup log looks like this:

ip: SIOCSIFFLAGS: Operation not permitted,
ip: can't send flush request: Operation not permitted,
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level,
Press the [f] key and hit [enter] to enter failsafe mode,
ip: RTNETLINK answers: Operation not permitted

I run OpenWrt in a LXD container on NUC and have tried to use Wifi in OpenWrt by running iw phy <phyname> set netns { <pid> | name <nsname> } on the host. But haven't succeeded using the wifi interface in OpenWrt. I think the reason is that OpenWrt uses many wifi patches both in the kernel and in user space tools. The user space wifi tools probably aren't compatible with a vanilla Linux kernel which I'm running. I guess you may experience the same problems unless you build your own kernel using OpenWrt's patches.

BTW the errors seen in your startup log probably can be solved by giving the container NET_ADMIN capability.

What you're actually saying is that router functionality of this container is practically not possible. That's a pity. But thanks for sharing your experience. I am curious if other users have experienced similar issues.

BTW, adding

cap_add:
- NET_ADMIN

solves the problem of the errors, however, the webui is now unreachable!

If you by router mean wifi router, then yes it doesn't seem possible.

I use an external VLAN capable wireless AP together with my router (which runs as a LXD container).

But I doubt Docker is a good choice for running a router anyway. Docker is designed for application virtualization, and not system virtualization and Docker wants to control IP address assignments which makes it hard to run a router.

LXD containers are similar to VMs but with less overhead (and in recent LXD versions you also can run VMs if you want). And there is no problem to run a router in a container or VM.

@mikma has already answered this question well, but I want to add the following:

  • a Raspberry Pi (all models) in general is not a good choice for a wifi router. The Pi4 has plenty of power for the routing functions, but the wifi radio on the Pi is not a good option for an AP, as it is a 1x1 radio with a small antenna that is not optimized for multiple client connections. Yes, you could connect a USB wifi radio dongle, but even those typically aren't that great.
  • If you are looking for good wifi performance, you should consider either a separate Wifi AP or an all-in-one wifi router device with appropriate hardware to serve as a primary AP.

@mikma and you indeed gave great answers.

And I agree, it is not a great choice for a wifi router, but it was just a tryout for me to experience openWRT. That's why I was wondering whether I could run it in Docker as I am a bit of a Docker freak. Anyway, thanks for explaining.