博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
怎样取得 VirtualBox 虚拟机器 ip
阅读量:6405 次
发布时间:2019-06-23

本文共 2108 字,大约阅读时间需要 7 分钟。

hot3.png

Re: how to get IP of guest operating system? Postby joseph1962smith » 1. Dec 2010, 05:15

From your question, I am assuming you are trying to get the IP address of the guest VM from the host system on which the guest VM is running.

The suggestion to use ipconfig (win) or ifconfig (*nix) will only give the IP address of the guest if the command is executed inside the guest VM.

VirtualBox does provide the ability to query guest VM properties using the "VBoxManage guestproperty" option. The "VBoxManage guestproperty" command can be executed against running and non-running guest VMs. Some properties (like the IP address) it appears will only be returned if the guest VM is running.

Here is an example of the "VBoxManage guestproperty enumerate <vmname>" from one of my guest VMs (this command was executed on the host):

$> VBoxManage guestproperty enumerate donaldOracle VM VirtualBox Command Line Management Interface Version 3.2.10(C) 2005-2010 Oracle CorporationAll rights reserved.Name: /VirtualBox/HostGuest/SysprepExec, value: , timestamp: 1290219934758787000, flags: TRANSIENT, RDONLYGUESTName: /VirtualBox/HostGuest/SysprepArgs, value: , timestamp: 1290219934758851000, flags: TRANSIENT, RDONLYGUESTName: /VirtualBox/GuestAdd/Vbgl/Video/SavedMode, value: 1024x768x32, timestamp: 1290219983629457000, flags: Name: /VirtualBox/GuestInfo/OS/Product, value: Linux, timestamp: 1290219981673702000, flags: ...

The IP related information is contained in the "Net" group of properties. To retrieve a specific value, use the "VBoxManage guestproperty get <vmname> <pattern> command.

Here is an example of the "VBoxManage guestproperty get <vmname> <pattern>" from one of my guest VMs (this command was executed on the host):

$> VBoxManage guestproperty get donald "/VirtualBox/GuestInfo/Net/0/V4/IP"Oracle VM VirtualBox Command Line Management Interface Version 3.2.10(C) 2005-2010 Oracle CorporationAll rights reserved.Value: 192.168.0.54$>

From my testing, it seems the guest properties are only available if the guest VM has the Guest Additions installed.

转载于:https://my.oschina.net/xieyunzi/blog/354741

你可能感兴趣的文章
Git 仓库大扫除
查看>>
设计模式-单例模式
查看>>
es6基础0x014:WeakMap
查看>>
九种 “姿势” 让你彻底解决跨域问题
查看>>
php中mysqli 处理查询结果集总结
查看>>
你不知道的JavaScript运算符
查看>>
小程序开发注意事项
查看>>
ECMAScript7规范中的instanceof操作符
查看>>
Hadoop HDFS原理分析
查看>>
【webpack4】基本配置和入门api
查看>>
Mac使用ssh公钥登录Linux
查看>>
【366天】跃迁之路——程序员高效学习方法论探索系列(实验阶段124-2018.02.06)...
查看>>
POJ3070-Fibonacci(矩阵快速幂)
查看>>
[vue插件]基于vue2.x的电商图片放大镜插件
查看>>
标准的组件结构
查看>>
vue——一个页面实现音乐播放器
查看>>
SVG 扬帆起航
查看>>
NET Core-学习笔记(二)
查看>>
职业生涯上的点点滴滴
查看>>
Linux下添加新硬盘,分区及挂载
查看>>