Deploy Windows to LXD VMs on different subnets with external DHCP

Is someone able to help explain how I can configure LXD / KVM VMs using MaaS so VMs can be deployed to multiple tagged vlans + subnets? And, also use external DHCP for these vlans + subnets?

Quick environment overview:

  • MaaS 3.5.1 + Ubuntu 22.04.5 running on vSphere VM
  • Single NIC on MaaS VM, connected to a dedicated /24 ‘MaaS Provisioning’ network

I’m currently using MaaS to deploy Windows Server (yes, I know - not my choice, but I have to) to bare metal.
Each bare metal host has 2 x Mellanox Connectx4 NICs bonded together as follows:

  • bond0 - MaaS Provisioning Subnet (untagged) - IP Mode ‘Unconfigured’
  • bond0.vlantag - Subnet for Vlan - IP Mode ‘DHCP’

Surprisingly this works really well - pretty thrilled to see this config automatically setup a LBFO bond in Windows Server + with appropriate vlan tag in windows - awesome!

However, for efficiency, I would now like to try deploying Windows images to LXD VMs, using the same hosts with ubuntu deployed on metal instead of Windows - but it seems MaaS handles networking on VMs differently to bare metal. It’s unable to set the vlan tag on a deployed windows machine.

So - my question is:

How do I configure networking on the Ubuntu hosts + LXD VMs, so I can build VMs on a tagged vlan + subnet of my choosing, while still relying on external DHCP servers for IP configuration?

Stuff I’ve tried:

Test - Set VM’s NIC (ie ‘edit physical’) to use the vlan + subnet + DHCP IP mode
Result - ‘Validate Network Config’ results in ‘Machine must be connected to a network’

Test - Set the VM’s NIC to untagged MaaS Provisioning network with IP mode ‘unconfigured’ + Add vlan with vlan’s Subnet + DHCP IP Mode
Result - Network validation fails on gateway connectivity - unable to communicate to the maas metadata service - presumably because it doesn’t get an IP on the MaaS provisioning / untagged subnet because IP mode is ‘unconfigured’ (this works on a bare metal host though, so :shrug:)

Test - Set the VM’s NIC to untagged MaaS Provisioning network with IP mode ‘DHCP’ + Add vlan with vlan’s Subnet + DHCP IP Mode
Result - Network validation works! Deployment Works! But, it fails to get an address from external DHCP. (I believe this is because MaaS doesn’t know how to configure VirtIO NIC’s vlan tag, so it is left on the MaaS Provisioning Subnet.)…

Really appreciate any help you can provide!