1
的vboxadd-service
在我的VirtualBox的客人必须运行从以下VagrantFile
代码片段获得IP,否则按预期vagrant hostupdater
命令将不起作用:保持guest虚拟机上运行的vboxadd服务没有与主机同步时间?
config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
if vm.id
`VBoxManage guestproperty get #{vm.id} "/VirtualBox/GuestInfo/Net/2/V4/IP"`.split()[1]
end
end
所得/etc/hosts
文件时vboxadd-service
关闭:
## vagrant-hostmanager-start
value bareOSdirector
value webserver
value bareOSremoteSD
## vagrant-hostmanager-end
,这是因为...
如果vboxadd-service
正在运行...你可以运行此命令,并得到:
VBoxManage guestproperty get "turnkey_lamp_packer_test_webserver_1502906374188_41719" "/VirtualBox/GuestInfo/Net/2/V4/IP"
Value: 10.0.3.8
但是,如果它没有运行,而不是你将得到:
VBoxManage guestproperty get "turnkey_lamp_packer_test_webserver_1502906374188_41719" "/VirtualBox/GuestInfo/Net/2/V4/IP"
No value set!
但为了让我能够轻松地更改时间在我的虚拟机测试事情...... vboxadd-service
必须不在guest虚拟机上运行,否则,当我使用sudo date -s
命令更改时,时间将与主机同步。
除了每次启动和停止服务外,如何保持vboxadd-service
运行而忽略时间同步?有没有办法保持服务运行,而不与主机同步时间?