0

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).

MrMeszaros
  • 105
  • 4

1 Answers1

0

The steps on this page might be sufficient for you: https://nts.strzibny.name/inception-running-vagrant-inside-vagrant-with-kvm/

stellarpower
  • 156
  • 5