Problem attaching/detaching network on VM

Hello!

I’m still learning on how to use incus, so please forgive my ignorance in a few matters.

I’ve created an VM called “rock” which was connected to the network via the default bridge incusbr0. I wanted the instance to be reachable over the local network, so I initialised an macvlan network that is described like here.

The VM had an locally reachable IPv4 adress. Then I modified a few settings: detached and attached the macvlan network from and to “rock”. Somehow this broke something and my VM has a 10.x.x.x adress again.

I think, when I intially set up the macvlan network, I might not have detached the bridge correctly.

+----------------+---------+------------------------+
|      NAME      |  STATE  |          IPV4          |
+----------------+---------+------------------------+
| rock           | RUNNING | 10.36.173.213 (enp5s0) |

The config shows that the attached network is macvlan. However the volatile.eth0.host_name is tape68e1c99 which (according to ip a) is connected to incusbr0. ( values with * *have been edited out by me)

$ incus config show rock
architecture: x86_64
config:
  image.architecture: amd64
  image.description: Debian bookworm amd64 (20260126_05:24)
  image.os: Debian
  image.release: bookworm
  image.serial: "20260126_05:24"
  image.type: disk-kvm.img
  image.variant: default
  volatile.base_image: *long-string*
  volatile.cloud-init.instance-id: *x-x-x-x*
  volatile.eth0.host_name: tap2162f094
  volatile.eth0.hwaddr: *ZZ:ZZ:ZZ:ZZ:ZZ:ZZ*
  volatile.last_state.power: RUNNING
  volatile.last_state.ready: "false"
  volatile.macvlan.host_name: mac518c6c6a
  volatile.macvlan.hwaddr: *AA:AA:AA:AA:AA:AA*
  volatile.macvlan.last_state.created: "false"
  volatile.uuid: *z-z-z-z-z*
  volatile.uuid.generation: *g-g-g-g-g*
  volatile.vm.definition:*string*
  volatile.vm.needs_reset: "true"
  volatile.vm.rtc_adjustment: "-7"
  volatile.vm.rtc_offset: "0"
  volatile.vsock_id: *numbers*
devices:
 macvlan:
    network: macvlan
    type: nic
  root:
    path: /
    pool: rock-pool
    type: disk
ephemeral: false
profiles:
- default
stateful: false
description: ""
...

Exert from ip a result:

2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether DD:DD:DD:DD:DD:DD brd ff:ff:ff:ff:ff:ff
    altname enp1s0f0
    inet *192.1.1.1/24* metric 100 brd *192.1.1.255* scope global dynamic eno1
       valid_lft 4545sec preferred_lft 4545sec
    inet6 *ipv6_adress*/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 86125sec preferred_lft 14125sec
    inet6 *second_ipv6_adress*/64 scope link 
       valid_lft forever preferred_lft forever

10: incusbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether *XX:XX:XX:XX:XX:XX* brd ff:ff:ff:ff:ff:ff
    inet 10.36.173.1/24 brd 10.36.173.255 scope global incusbr0
41: tap2162f094
: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master incusbr0 state UP group default qlen 1000
    link/ether *CC:CC:CC:CC:CC:CC* brd ff:ff:ff:ff:ff:ff
44: mac518c6c6a@eno1: <BROADCAST,MULTICAST,ALLMULTI,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
    link/ether *LL:LL:LL:LL:LL:LL* brd ff:ff:ff:ff:ff:ff

It’s not that important to get things running again as they were. I’m still learning and going to redo what I learned in a new project. More importantly than a quick fix, I want to learn what happend, how it happened and what I should/could have done differently. As of now I’m a bit stuck.

The VM is still connected via incusbr0 but using incus network detach incusbr0 rock delivers the message

Error: No device found for this network

So I a nutshell

  1. What is happening above?
  2. How do I correctly detach a bridge and attach a macvlan interface. (And viceverse)

Thank you for your patience :slight_smile:


Edit: I was able to make it work by changing

devices:
 macvlan:
    network: macvlan
    type: nic

to

devices:
  eth0:
    name: eth0
    network: macvlan
    type: nic


You default profile has this:

devices:
  eth0:
    network: incusbr0
    type: nic

And rock is using default profile. Then you overwrite eth0 the incusbr0 with eth0 the macvlan, now rock is not connecting to incusbr0, so ip address is not 10.x.x.x. When you detach eth0 the macvlan, eth0 changes to eth0 the incusbr0. It explains why 10.x.x.x address shows again. That’s what happened.

You can change eth0 the macvlan to eth1 the macvlan, then disable eth0 and enable eth1 in rock network config, then above won’t ever happen again.

If you want to create some new locally reachable instances, create a profile by copy default but change eth0 part to use macvlan, then you can create them with this profile.

I’ve never use this: incus network detach incusbr0, so I can’t answer the question.

1 Like