[lxc-users] Access to Wi-Fi dongle from within lxc container...

Patrick Doyle wpdster at gmail.com
Mon Dec 9 02:21:32 UTC 2019


TL;DR - is it possible to access a Wi-Fi dongle from within an lxc
container?  If so, how?


I realize this isn't a typical use case, but I hope it is more typical
than the creators of LXC first imagined.
I would like to use an lxc container to develop Ubuntu 18.04 specific
software on my Ubuntu 16.04 laptop.  Part of the testing I need to do
requires access to a Wi-Fi network.  I have tried various bridge
combinations to make this work and none of them have been successful.

So I decided to just plug a Wi-Fi dongle into a USB port and use that
directly from the container.

The problem is... I don't know how to provide the wpa supplicant SSID
and password to the Wi-Fi adapter.

I tried:

$ lxc config device add first eth1 nic nictype=physical parent=wlx803f5d19f6d2
$ lxc start first
$ lxc exec first -- /bin/bash

root at first:~# ifconfig

and I see that eth1 exists in my first container (cleverly named
"first").  Then I tried creating a netplan .yaml file to set the SSID
and password:

network:
    version: 2
    wifis:
        eth1:
            dhcp4: true
            access-points:
                "home":
                     password: "**********"

but when I try running "netplan try" in the container, it times out
eventually, and fails.

As I thought about this, I started wondering if the "eth1" interface
in the container looks more like an ethernet interface and not at all
like a wlan interface, and if perhaps that is the source of my
problem.  Another possible source of my problem is that I have never
even heard of netplan before this evening, so I have no experience
with that whatsoever.

Any thoughts or tips?

--wpd


More information about the lxc-users mailing list