gpt4 book ai didi

vagrant - 配置网络适配器时在 win7 上挂起 vagrant 的问题

转载 作者:行者123 更新时间:2023-12-02 18:38:14 25 4
gpt4 key购买 nike

Vagrant 版本:1.4.0vagrant-windows版本:1.5.1

Vagrant 文件:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "win7.x86.v.004"
config.vm.box_url = "URL"
config.vm.boot_timeout = 300
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
config.windows.halt_timeout = 15
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.vm.guest = :windows
config.vm.network :forwarded_port, guest: 5985, host: 5685, id: "winrm", :auto => true
config.vm.network :forwarded_port, guest: 5986, host: 5686
config.vm.network :forwarded_port, guest: 8080, host: 5687
config.vm.network :forwarded_port, guest: 1521, host: 5688
config.winrm.host = "192.168.33.33"
config.winrm.port = 5985
config.windows.set_work_network = true
config.vm.network :private_network, ip: "192.168.33.33"
config.vm.provision :shell, :path => "provision.bat"
end

我使用的是自建的Win7企业版SP1盒子

vagrant up 在配置网络适配器时挂起,调试日志位于此处:

DEBUG configure_networks: vm_interface_map: {1=>{:net_connection_id=>"Local Area
Connection", :mac_address=>"08002753776B", :interface_index=>"11", :index=>"7"}
, 2=>{:net_connection_id=>"Local Area Connection 2", :mac_address=>"080027F5E843
", :interface_index=>"14", :index=>"12"}}
INFO winrmshell: Configuring NIC Local Area Connection 2 using static ip 192.16
8.33.33
DEBUG winrmshell: powershell executing:
netsh interface ip set address "Local Area Connection 2" static 192.168.33.33 25
5.255.255.0

“netsh”命令执行后挂起。

有什么解决办法可以解决这个问题吗?

最佳答案

找到解决方案,在我的 VagrantFile 中有错误

config.winrm.host = "192.168.33.33"

这应该是主机IP地址,但我使用了访客IP,这就是为什么在执行netsh命令“vagrant up”时默默地挂起。原因是netsh命令重置了网络接口(interface),vagrant无法获取netsh命令的结果。

主要是这个参数不应该设置或者设置为127.0.0.1

关于vagrant - 配置网络适配器时在 win7 上挂起 vagrant 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21822768/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com