Asc*_*ius 36
以下设置允许我的客人可靠地保持时间精确到我的主机 1 秒以内。它使用运行 VirtualBox 4.3.26 的主机和运行相同版本的 VirtualBox Guest Additions 的来宾进行测试。至于 VirtualBox 5.x,到目前为止,我还没有任何需要进行这些配置更改;时间已经自动同步了。
参考:https : //www.virtualbox.org/manual/ch09.html#changetimesync
在主机上,列出 VM 以确定相关 VM 的名称。
$ VBoxManage list vms | awk '{print $1}'
"CentOS6"
Run Code Online (Sandbox Code Playgroud)
在主机上,通过运行以下命令为来宾配置时间同步参数。首先设置$VMNAME
其适当的值。如果 的值$VMNAME
包含空格,当然应该用引号引起来。
$ VBoxManage guestproperty set ${VMNAME} "/VirtualBox/GuestAdd/VBoxService/--timesync-interval" 10000
$ VBoxManage guestproperty set ${VMNAME} "/VirtualBox/GuestAdd/VBoxService/--timesync-min-adjust" 100
$ VBoxManage guestproperty set ${VMNAME} "/VirtualBox/GuestAdd/VBoxService/--timesync-set-on-restore" 1
$ VBoxManage guestproperty set ${VMNAME} "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" 1000
Run Code Online (Sandbox Code Playgroud)
上述时间参数的值已被限制为 10 的倍数。设置timesync-set-threshold
为 10000可能很诱人,但这可能会在触发时发生相当剧烈的时间变化,因此可能会中断应用程序。
在主机上,查看来宾的更新相关值。这些可以随时重新确认。
$ VBoxManage guestproperty enumerate ${VMNAME} | grep timesync | sort
Name: /VirtualBox/GuestAdd/VBoxService/--timesync-interval, value: 10000, timestamp: 1402110397618554000, flags:
Name: /VirtualBox/GuestAdd/VBoxService/--timesync-min-adjust, value: 100, timestamp: 1402110777505446000, flags:
Name: /VirtualBox/GuestAdd/VBoxService/--timesync-set-on-restore, value: 1, timestamp: 1402110904964050000, flags:
Name: /VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold, value: 1000, timestamp: 1402110660162295000, flags:
Run Code Online (Sandbox Code Playgroud)
在来宾上,停止并禁用所有内部 NTP 和相关计时服务。不应使用它们,因为它们可能会干扰 VirtualBox。在 CentOS 6 客户机上:
$ sudo /sbin/chkconfig ntpd off
$ /sbin/chkconfig --list | grep ntp
ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Run Code Online (Sandbox Code Playgroud)
在来宾上,重新启动名为 的服务vboxadd-service
。假设之前安装了 Guest Additions,则该服务将已安装并启用。在 CentOS 6 客户机上:
$ /sbin/service vboxadd-service status
Checking for VBoxService ...running
$ sudo /sbin/service vboxadd-service restart
Stopping VirtualBox Guest Addition service [ OK ]
Starting VirtualBox Guest Addition service [ OK ]
$ /sbin/service vboxadd-service status
Checking for VBoxService ...running
Run Code Online (Sandbox Code Playgroud)
如果来宾上的时间尚未同步,请重新启动来宾。
Nik*_*nko 16
对于 Linux 主机,首先在来宾计算机上安装 DKMS(动态内核模块支持)包(源):
$ sudo apt-get install dkms
Run Code Online (Sandbox Code Playgroud)
然后将 Guest Additions 安装到来宾系统中:
$ sudo apt-get install virtualbox-guest-additions
Run Code Online (Sandbox Code Playgroud)
此外,这里是一些用于调整 VirtualBox 时间同步的命令的描述。
归档时间: |
|
查看次数: |
80241 次 |
最近记录: |