Skip to content

Instantly share code, notes, and snippets.

@platu
Last active October 14, 2024 17:25
Show Gist options
  • Save platu/7f24a3b57c5a271639b67bd87c142466 to your computer and use it in GitHub Desktop.
Save platu/7f24a3b57c5a271639b67bd87c142466 to your computer and use it in GitHub Desktop.
Host Incus containers networked on VLANs in the physical world

Host Incus containers networked on VLANs in the physical world

The installation process begins with a Debian trixie base installation on the host system or virtual machine.

It is important to note that this system is networked on a trunk mode port, which allows for the sharing of VLANs between the host or virtual machine and other devices on the networks.

Target topology

The lab system offers a minimum of three different VLANs, as illustrated by this example topology.

  • Blue: management VLAN used to access the lab system
  • Green: one VLAN used to connect some containers
  • Orange: another VLAN used to connect some other containers

Make sure that Netplan, OvS, and Incus are installed before to begin

sudo apt update
sudo apt -y full-upgrade
sudo apt -y install netplan.io openvswitch-switch
sudo apt -y install incus --no-install-recommends
apt search ^netplan.io$
netplan.io/testing,now 1.1-2 amd64  [installé]
  Declarative network configuration for various backends at runtime
apt search ^openvswitch-switch$
oopenvswitch-switch/testing,now 3.4.0-1 amd64  [installé]
  Open vSwitch switch implementations
apt search ^incus$
incus/testing,now 6.0.2-1 amd64  [installé]
  Powerful system container and virtual machine manager - daemon

Prepare the declarative network configuration file

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s1:
      dhcp4: false
      dhcp6: false
      accept-ra: false

  openvswitch: {}

  bridges:
    c-3po:
      openvswitch: {}
      interfaces: [enp0s1]

  vlans:
    mgmt:
      id: 30
      link: c-3po
      dhcp4: true
      accept-ra: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment