2 IPs (host and guest) in the same subnet using macvlan

You may be able to use macvlan on top of the host’s VLAN interface but macvlan has a tendency to be pretty fragile and can have driver-specific behavior.

If possible, the cleaner approach is to configure a bridge on your host system through your distribution’s network configuration tool. You’re mentioning Ubuntu 24.04 LTS so in that case, that’d be netplan.

What I’d probably do in your scenario, considering a physical network interface named eth0 is:

  • Define eth0 in netplan but set dhcp4: false, dhcp6: false, accept-ra: false so it doesn’t get any configured addresses
  • Define a eth0.1234 VLAN interface with eth0 as the link and 1234 as the id, also have dhcp4, dhcp6 and accept-ra disabled on this
  • Define a br1234 bridge interface which includes eth0.1234, that interface will have your host’s IP configuration on it, whether that’s DHCP or static

In Incus, you can then use a nic device which looks like this to add an instance to your VLAN 1234:

type: nic
nictype: bridged
parent: br1234
name: eth0

You can do some fancier things too by having just a single bridge (br0) which would include eth0 and then has VLAN filtering enabled so that you can instead do this in Incus:

type: nic
nictype: bridged
parent: br0
vlan: 1234
name: eth0

That’s what I do on my production servers, but Netplan doesn’t have full support for this, so I need some additional systemd-networkd units on my system to properly handle that (turn on VLAN filtering and configure the list of valid VLAN IDs on the bridge parent device, eth0 in this scenario)