我正在尝试使用 vagrant 设置一些虚拟机,我希望它们在我的计算机网络中可见。但这不起作用..也许你可以在那里帮助我......
...据我了解,libvirt 为此创建了一个虚拟桥。 ......这存在..虽然我不知道为什么它不活跃
$ sudo brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.52540096e2dd yes
$ virsh -c qemu:///system iface-list --all
Name Status MAC-Adresse
---------------------------------------
eno1 Aktiv 40:b0:34:f7:c5:39
lo Inaktiv 00:00:00:00:00:00
virbr0 Inaktiv 52:54:00:96:e2:dd
我得到了一个看起来像这样的草稿配置:
Vagrant.configure("2") do |config|
# first initialize the basic box parameters
config.vm.box = "generic/debian11"
config.vm.host_name = "draft"
config.vm.network :public_network,
:dev => "virbr0",
:mode => "bridge",
:type => "bridge"
end
据我所知,虚拟机现在应该连接到网桥,这应该会导致机器在网络范围内可见。 .. 但它不是
$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
Libvirt Provider:
* network configuration 0 for machine default is a public_network referencing host device 'virbr0' which does not exist, consider adding ':dev => ....' referencing one of eno1
只是为了完整性,我在 libvirt 9.0.0 和 Debian 12 (Bookworm) 上运行。
$ virsh version
Kompiliert gegen die Bibliothek: libvirt 9.0.0
Verwende Bibliothek: libvirt 9.0.0
Verwende API: QEMU 9.0.0
Laufender Hypervisor: QEMU 7.2.0
$ uname -a
Linux kublech 6.1.0-7-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.20-1 (2023-03-19) x86_64 GNU/Linux