Failed to open/create the internal network ‘HostInterfaceNetworking-VirtualBox Host-Only Ethernet Ad

脚本创建多台虚拟机,启动报错

win11系统
vritual Box应用
服务器版本: centos7

1. 启动脚本

boxes = [
	{
		:name => "k8s-m",
		:eth1 => "192.168.56.21",
		:mem => "2048",
		:cpu => "4",
		:sshport => 22230
	},
	{
		:name => "k8s-w1",
		:eth1 => "192.168.56.22",
		:mem => "2048",
		:cpu => "4",
		:sshport => 22231
	},
	{
		:name => "k8s-w2",
		:eth1 => "192.168.56.23",
		:mem => "2048",
		:cpu => "4",
		:sshport => 22232
	}
]
Vagrant.configure(2) do |config|
	config.vm.box = "centos/7"
	Encoding.default_external = 'UTF-8'
	boxes.each do |opts|
		config.vm.define opts[:name] do |config|
			config.vm.hostname = opts[:name]
			config.vm.network "private_network", ip: opts[:eth1]
			config.vm.network "forwarded_port", guest: 22, host: 2222, id: "ssh", disabled: "true"
			config.vm.network "forwarded_port", guest: 22, host: opts[:sshport]
			#config.ssh.username = "root"
			#config.ssh.password = "root"
			#config.ssh.port=opts[:sshport]
			#config.ssh.insert_key = false
			#config.vm.synced_folder ".", "/vagrant", type: "rsync" 
			config.vm.provider "vmware_fusion" do |v|
				v.vmx["memsize"] = opts[:mem]
				v.vmx["numvcpus"] = opts[:cpu]
			end
			config.vm.provider "virtualbox" do |v|
				v.memory = opts[:mem];
				v.cpus = opts[:cpu];
				v.name = opts[:name];
			end
		end
	end
end

2. 报错如下

Failed to open/create the internal network ‘HostInterfaceNetworking-VirtualBox Host-Only Ethernet Ad_第1张图片

Stderr: VBoxManage.exe: error: Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter' (VERR_INTNET_FLT_IF_NOT_FOUND).
VBoxManage.exe: error: Failed to attach the network LUN (VERR_INTNET_FLT_IF_NOT_FOUND)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsol

3. 解决方案

Failed to open/create the internal network ‘HostInterfaceNetworking-VirtualBox Host-Only Ethernet Ad_第2张图片
Failed to open/create the internal network ‘HostInterfaceNetworking-VirtualBox Host-Only Ethernet Ad_第3张图片
Failed to open/create the internal network ‘HostInterfaceNetworking-VirtualBox Host-Only Ethernet Ad_第4张图片

4. cmd 管理员模式下执行vagrant up

你可能感兴趣的:(vagrant,virtual,Box)