我已将 VirtualBox 从 6.1.26-2 升级到 6.1.28-3(在 Manjaro 中),然后我无法使用 Vagrant 建立专用网络。这是我的流浪文件:
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.hostname = "Name"
config.vm.network :forwarded_port, guest: 22, host: 2336, id: 'ssh'
config.vm.network :private_network, ip: "10.1.45.3", netmask: "255.255.0.0"
end
当我执行 avagrant up
时,我得到:为仅主机网络配置的 IP 地址不在允许的范围内。请更新以前在允许范围内的地址,然后再次运行该命令。
Address: 10.1.45.3
Ranges: 192.168.56.0/21
Valid ranges can be modified in the /etc/vbox/networks.conf file. For
more information including valid format see:
https://www.virtualbox.org/manual/ch06.html#network_hostonly
我按照链接中的指南创建了文件 /etc/vbox/networks.conf :
0.0.0.0/0 ::/0
而且,当我vagrant up
再次跑步时,我得到了:
The IP address configured for the host-only network is not within the
allowed ranges. Please update the address used to be within the allowed
ranges and run the command again.
Address: 10.1.45.3
Ranges:
Valid ranges can be modified in the /etc/vbox/networks.conf file. For
more information including valid format see:
https://www.virtualbox.org/manual/ch06.html#network_hostonly
为什么“范围”是空的?我尝试使用其他范围值,但它没有改变任何东西。
我检查了 NAT 接口的 IP,没有冲突(10.0.2.15/24)。
*
行的开头有一个缺失。文件networks.conf应该是: