LXC/virt-manager: No network on WiFi connection

In a follow-up to here: Best user-friendly system container software?

Intro notes:

  • Manjaro Host OS
  • Using WiFi primarily (cannot use ethernet)

I did the following to install packages:

sudo pacman -Syu lxc virt-manager

As per what I found on the internet, I changed my LXC /etc/lxc/default.conf to look like this:

lxc.net.0.type = veth
lxc.net.0.link = virbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx

After installing both packages, it wasn’t clear how to create an LXC container from the virt-manager GUI, so I did:

sudo lxc-create --template download --name test

I followed the prompts and setup a Debian/latest/amd64 container (note. I also tried an Ubuntu container but Ubuntu fails to start due to some apparmor/other issues that I did not want to spend time figuring out). Output of my container config:

# Template used to create this container: /usr/share/lxc/templates/lxc-download
# Parameters passed to the template:
# Template script checksum (SHA-1): 02188c2dde4bb30d6f3e4f87a4baa548d56dc8b8
# For additional config options, please look at lxc.container.conf(5)

# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)


# Distribution configuration
lxc.include = /usr/share/lxc/config/common.conf
lxc.arch = linux64

# Container specific configuration
lxc.rootfs.path = dir:/var/lib/lxc/test/rootfs
lxc.uts.name = test

# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = virbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:33:b2:ca

I followed this guide: Linux Containers via LXC and Libvirt - Scott's Weblog - The weblog of an IT pro focusing on cloud computing, Kubernetes, Linux, containers, and networking

to create a virt-manager profile. Here is my test.xml file:

<domain type='lxc'>
  <name>test</name>
  <memory>327680</memory>
  <os>
    <type>exe</type>
    <init>/sbin/init</init>
  </os>
  <vcpu>1</vcpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/lib/libvirt/libvirt_lxc</emulator>
    <filesystem type='mount'>
      <source dir='/var/lib/lxc/test/rootfs'/>
      <target dir='/'/>
    </filesystem>
    <interface type='network'>
      <source network='default'/>
    </interface>
    <console type='pty'/>
  </devices>
</domain>

I looked at this article: NAT-based network — libvirt Networking Handbook — Jamie Nguyen and it seems my NAT is configured as the guide says.

I also read that I need to start the libvirt network, so I did:

sudo virsh net-start default

When I open virtmanager I see the LXC container and I can start it. As the shell via virtmanager goes to login and LXC containers have no username/password, I connect to the container:

sudo lxc-execute -n test /bin/bash

But once inside the container, I have no network connection:

ping 8.8.8.8
ping: connect: Network is unreachable

Questions:

  1. Is my setup correct? There are nearly 0 recent step-by-step guides for virt-manager/LXC (the article linked is almost 10 years old)
  2. How do I get the network to work? I’d like to avoid complicated config adjustments, but I will resort to it if I have no other solution
  3. Is QEMU easier to use with virt-manager in comparison to LXC?