Sample Header Ad - 728x90

Nested Libvirt (KVM) fails to create network with vagrant

0 votes
1 answer
788 views
I want to create a nested virtual machine with network access. I use vagrant on the Host (Layer 0) to create the Layer 1 guest, and then would want to use vagrant to create a Layer 2 guest (inside the Layer 1). However, when I try to create the Layer 2 machine, vagrant up fails with:
Error while activating network: Call to virNetworkCreate failed: internal error: Network is already in use by interface eth0.
I think I added a second NIC to the Layer 1 so that it can use it for the Layer 2 but I am unsure. I am a little new to VM nesting, so am not sure how to resolve this. Here is my config: ##### Host Vagrantfile
ENV["VAGRANT_DEFAULT_PROVIDER"] = "libvirt"

Vagrant.configure("2") do |config|
  config.vm.define "u22" do |ubuntu|
    ubuntu.vm.box = "generic/ubuntu2204"
    # Tests:
    # ubuntu.vm.network "public_network", :dev => "wlp3s0"
    # ubuntu.vm.network "private_network", dhcp: true
    ubuntu.vm.network "private_network", ip: "10.10.10.30"
  end
end
##### Guest Vagrantfile
ENV["VAGRANT_DEFAULT_PROVIDER"] = "libvirt"

Vagrant.configure("2") do |config|
  config.vm.box = "centos/stream8"
end
The host is an Ubuntu 20.04. Not sure if this is enough info (please ask away, I'm a noobie).
Asked by MrMeszaros (105 rep)
Nov 15, 2022, 04:48 PM
Last activity: Jun 14, 2023, 08:39 PM