IncusOS instance VLANs and static IP-addresses

Hello,

I’m currently migrating my homelab from Proxmox to IncusOS and going from a single subnet to a few VLANs. I’ve got everything else in the network working like it should, but even with the docs and earlier forum posts, i just can’t wrap my head around how to get the IncusOS host management to talk on one VLAN and the instance NICs on whatever different VLANs they need to be on in the simplest way possible.

Assuming the starting point is a fresh IncusOS install on a host machine with a single physical NIC eno1 connected to a switch hybrid port (trunk + untagged access to VLAN 20), here’s an example of what i’m trying to achieve:

  • Configure the IncusOS host to have a locally configured static IP on VLAN 20 for management. Can be either tagged by the host, or leave it untagged and have the switch tag it down the line.
  • Configure Incus profiles, networks or whatever is applicable with the aim of “give the instance a NIC called ethX with access to the wider network via eno1, tagged with VLAN ID X”.
  • Launch an instance with one or more of the aforementioned configs or networks, plus per instance configs of either static IP assignments or directives to request addresses from DHCP located elsewhere in the network. Avoid having to go into the instance OS to configure networking.

This sounds like a simple thing to set up, but having read dozens of docs, threads and guides at this point, i’m totally confused on how to handle the different levels of configuration (IncusOS/Incus/instance) to form a working whole. How would you set this up? Thanks in advance!

Okay, so i gave it an hour or two of best guess trial and error and got to a point that i have a workable setup with the desired VLAN isolation. I still don’t understand if this is in any sense the “right” way to do it, so i am not marking this as solved in case someone wishes to discuss this with me here. It might also be of use to someone else who is struggling with similar issues.

The configs below are missing proper DNS settings and such on purpose to be added later once i am sure i don’t need to redo all this again. The only base thing i couldn’t figure out now is how to have Incus fully set up a second instance NIC like the first one, but i think i can work around it by having Incus configure the first and attach a second unconfigured NIC, which is then configured inside the container by Ansible down the line (the final plan would be to have Ansible create the containers anyway in the future, so it’s not going against my aim to limit configuration sprawl).

I’m not sure if this makes any sense either, but the only way i was able to get the instance NIC on a VLAN and have Incus set it’s IP address was to use Docker OCI images instead of the images that come from the default image repo (example images:alpine/3.24 vs. docker:library/alpine:latest). I didn’t think to mention it before, but i plan to run mainly Alpine Linux system containers, not application containers in that sense. Doesn’t seem to affect the end result though, i can install packages on and interact with the instance spawned from the OCI image just like the one from the Incus repo.

incus remote add docker https://docker.io --protocol=oci --public

My IncusOS network config:

incus admin os system network show
WARNING: The IncusOS API and configuration is subject to change

config:
  dns:
    domain: ""
    hostname: ""
    nameservers:
    - 1.1.1.1
  interfaces:
  - addresses:
    - 10.20.2.1/16
    hwaddr: 10:e7:c6:ac:18:5e
    name: eno1
    required_for_online: "no"
    roles:
    - instances
    - management
    routes:
    - to: 0.0.0.0/0
      via: 10.20.0.1
    vlan_tags:
    - 10
    - 20
    - 30
  time:
    timezone: Europe/Helsinki

My Incus network:

incus network show eno1
config: {}
description: ""
name: eno1
type: bridge
used_by: []
managed: false
status: ""
locations: []
project: default

My Incus profiles:

incus profile show default
config: {}
description: Default Incus profile
devices:
  root:
    path: /
    pool: local
    type: disk
name: default
used_by:
- /1.0/instances/ct-vlan-test
project: default

incus profile show networking-eth0-vlan30
config: {}
description: ""
devices:
  eth0:
    name: eth0
    nictype: bridged
    parent: eno1
    type: nic
    vlan: "30"
name: networking-eth0-vlan30
used_by:
- /1.0/instances/ct-vlans-test
project: default

incus profile show networking-eth1-vlan10 
config: {}
description: ""
devices:
  eth1:
    name: eth1
    nictype: bridged
    parent: eno1
    type: nic
    vlan: "10"
name: networking-eth1-vlan10
used_by:
- /1.0/instances/ct-vlans-test
project: default

What happens if i try to launch an instance with two NICs directly configured by Incus:

incus launch docker:library/alpine:latest ct-vlans-test 
--profile default 
--profile networking-eth0-vlan30  
--profile networking-eth1-vlan10 
--device eth0,ipv4.address=10.30.0.55/16 
--device eth0,ipv4.gateway=10.30.0.1 
--device eth1,ipv4.address=10.10.0.55/16 
--device eth1,ipv4.gateway=10.10.0.1
Launching ct-vlans-test
Error: Failed instance creation: Failed to run: /opt/incus/bin/incusd forklxc ct-vlans-test /var/lib/incus/containers /run/incus/ct-vlans-test/lxc.conf /var/lib/incus/logs/ct-vlans-test: exit status 1

And finally, how i managed to launch an instance with two NICs but avoiding the former issue by dropping the second NIC configuration, which results in it successfully requesting a DHCP lease from elsewhere (would prefer to leave it totally unconfigured, but this is passable):

incus launch docker:library/alpine:latest ct-vlans-test 
--profile default 
--profile networking-eth0-vlan30 
--profile networking-eth1-vlan10
--device eth0,ipv4.address=10.30.0.55/16
--device eth0,ipv4.gateway=10.30.0.1

incus exec ct-vlans-test ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
85: eth0@if86: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 9000 qdisc noqueue state UP qlen 1000
    link/ether 10:66:6a:97:b6:10 brd ff:ff:ff:ff:ff:ff
    inet 10.30.0.55/16 brd 10.30.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::1266:6aff:fe97:b610/64 scope link 
       valid_lft forever preferred_lft forever
87: eth1@if88: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 9000 qdisc noqueue state UP qlen 1000
    link/ether 10:66:6a:d6:8a:6e brd ff:ff:ff:ff:ff:ff
    inet 10.10.100.41/16 brd 10.10.255.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::1266:6aff:fed6:8a6e/64 scope link 
       valid_lft forever preferred_lft forever

@mikael did you check this tutorial?

The key like ipv4.address=10.30.0.55/16 works only with OCI containers. If you want to set a static IP address for ordinary (LXC) containers, you need to configure the network from within the container by modifying /etc/network/interfaces.

I am also starting to migrate from Proxmox to IncusOS and I am having similar troubles. The setup is a fresh IncusOS install. I want to create a dmz network which will put its instances on vlan 2.

Network configuration:

config:
  dns:
    domain: internal
    hostname: tantal
  interfaces:
  - addresses:
    - dhcp4
    - slaac
    hwaddr: b4:2e:99:ff:3c:20
    name: enp4s0
    required_for_online: "no"
    roles:
    - instances
    vlan_tags:
    - 2
  time:
    timezone: America/Denver

I then created a physical network with VLAN ID 2 as instructed on the wiki:

incus network create dmz parent=enp4s0 vlan=2 --type=physical

And then launched a Debian instance:

incus launch images:debian/13 debian --network dmz

But the container is not getting an IP address.

What am I doing wrong?

Thanks for your reply. I did use that as a base, but created the network as a bridge instead, because i understood (incorrectly?) that using the physical type would only allow usage by one instance, which is obviously not great on a host with a single physical NIC. From the docs:

A physical NIC provides straight physical device pass-through from the host. The targeted device will vanish from the host and appear in the instance (which means that you can have only one physical NIC for each targeted device).

That’s all i have time for now unfortunately. I’ll be back with an update later - i think i got a more sensible fire-and-forget setup figured out using cloud-init in the profiles, which removes the need to mess with OCI images. Already got a POC done that builds a functioning Alpine + Pi-Hole container from scratch.

That is correct. However, the interfaces created by IncusOS are not physical NICs but bridges containing those NICs. From the documentation:

IncusOS automatically configures each interface and bond as a network bridge. This allows for easy out-of-the-box configuration of bridged NICs for containers and virtual machines.

So one can attach several containers to the managed “physical” networks created on these unmanaged bridges.

The container should get an IP address over DHCP from your link enp4s0. Is your DHCP server listening to VLAN 2? Could you try launching the container directly on your interface without using VLAN? Does it get an IP address?

incus network create enp4s0 parent=enp4s0 --type=physical
incus launch images:debian/13 test --network enp4s0

Why is suddenly everyone migrating to IncusOS from Proxmox? :smiley:

Yes, it gets a DHCP reservation just fine if I bind it directly to enp4s0. Additionally, I know that DHCP works on that VLAN because my proxmox LXC containers get reservations just fine, and I double checked the configuration on my router.

Personally, I wish to switch to IncusOS for several reason:

  • Encryption with TPM by default, which is technically possible on proxmox but is a giant PITA.
  • VMs, LXC, and OCI all as first-class citizens.
  • Creation and management of ZFS pools as a first class citizen.
  • Using ZFS snapshots for snapshotting instead of a bespoke system (proxmox backup server)
  • Immutable base OS with (presumably) reliable updates. I originally switched to proxmox because it let me do whatever, but now my homelab is a giant pile of undocumented hacks, so I want to go back to an immutable base system again.
  • I can run Incus without the whole OS, which lets me run my raspberry pi as a third node for quorum and some light workloads.

Can you obtain the address of the IncusOS host itself from the VLAN 2 by moving the addresses: section to the vlans: section?

config:
  confirmation_timeout: 5m
  dns:
    domain: internal
    hostname: tantal
  interfaces:
  - hwaddr: b4:2e:99:ff:3c:20
    name: enp4s0
    required_for_online: "no"
    roles:
    - instances
    vlan_tags:
    - 2
  vlans:
  - name: "uplink"
    parent: "enp4s0"
    id: 2
    addresses:
    - "dhcp4"
    - "slaac"  
  time:
    timezone: America/Denver

(I use confirmation_timeout: 5m so that in case you cannot connect to IncusOS over VLAN 2 the configuration is reverted)

See the documentation:

Otherwise, try setting a static IP from the debian container and check connectivity to the router.
I used static IP addresses on VLANs and had no problems.

Well now I feel very foolish… the system wasn’t getting IPs on the DMZ VLAN either, which very quickly led me to discover that I had disabled trunking on the switch port it is connected to a while back when testing something else. Now everything is working great! Thanks for the help.