Connecting a VM to a specific VLAN

I’ve got four machines that I’ve installed microcloud onto. The NICs are set up identically and configured as

NIC 1 192.168.15.x - This is notionally the management LAN. It should always be available if I mess the config up…

Bond 0

BR0 
VLAN.100 - 192.168.100.x

Bond 1
 VLAN.10 - 192.168.16.x OVN
 VLAN.15 - 192.168.17.x Cephs Mgmt
 VLAN.50 - 192.168.18.x Cephs Data

I can create a machine without an issue, but what I want to be able to do is for appropriate VMs add a second NIC that would be attached to VLAN.100 and allocated an IP address on 192.168.100.x so that the machine can be connected to from the rest of my network.

What I’m not sure is how to do that. I’m missing something in the documentation somewhere and I can’t work our what type of network to create.

I achieve this by directly connecting my instances to this bridge network. These networks are “unmanaged”, so you will not have access to all LXD features like the built-in IPAM, ACL, configuring via the UI etc.

You need to make sure each of your microcloud hosts has the exact same br0 name, otherwise your instances will not be able to move around between your hosts.

You already have your br0 bridge created on your host (via netplan). It shows up when you do lxc network ls, or check the Networks page in the UI.

At the moment it is not possible to configure this type of NIC via the UI (A feature request to make this possible already exists: Managed network to reference unmanaged bridges · Issue #15929 · canonical/lxd · GitHub )

But you can do this manually with the following yaml device config on an instance:

devices:
  eth0:
    name: eth0
    nictype: bridged
    parent: br0
    type: nic

I have created a profile for this type of network. It’s vlan9 on my side, so I named it eth9.
If you name it eth0, it will override the eth0 provided by the default profile. I needed both, so I chose to name it eth9.

I think that has done it. Or at least I can see the nic created and assign an IP address to it and it seems to be up.

I still can’t connect to the machine using the address I’ve allocated, although I suspect my problem is somewhere else now, possibly in the firewall. So I’ll have to try a few things.

Thanks for the help

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.