请问virtualBox 可以用 VBoxManage 命令设置虚拟系统的IP吗?

Kvm、VMware、Virtualbox、Xen、Qemu 等
回复
5589731
帖子: 4
注册时间: 2008-03-15 18:02

请问virtualBox 可以用 VBoxManage 命令设置虚拟系统的IP吗?

#1

帖子 5589731 » 2011-12-05 16:47

请问virtualBox 可以用 VBoxManage 命令设置虚拟系统的IP吗?

比如我在ubuntu下面用 vbox安装了一个虚拟系统 ,虚拟系统是 centos ,那么我怎么通过vbox的VBoxManage 不进入centos而修改 centos的IP地址呢? 请问可以做到吗???谢谢·· 求帮助 ··
头像
lilydjwg
论坛版主
帖子: 4258
注册时间: 2009-04-11 23:46
系统: Arch Linux
联系:

Re: 请问virtualBox 可以用 VBoxManage 命令设置虚拟系统的IP吗?

#2

帖子 lilydjwg » 2011-12-05 18:43

可以,根据网卡的不同分别对应 hostonlyif / dhcpserver / modifyvm --natbindip 子命令。不过你为什么需要这个呢?
5589731
帖子: 4
注册时间: 2008-03-15 18:02

Re: 请问virtualBox 可以用 VBoxManage 命令设置虚拟系统的IP吗?

#3

帖子 5589731 » 2011-12-07 17:21

首先谢谢你的回答,我目前的项目有个需求,是要用command line直接设置VBOX虚拟机的IP的 所以这么问 呵呵···

目前每个虚拟机都是桥接的 ,关于这个问题 我查了下外国的网站 , 如下:

set static IP addresses for VM using commandline
Post a reply

5 posts • Page 1 of 1
set static IP addresses for VM using commandline
by nkhoa » 9. Feb 2011, 20:50

hi there
I've been bugging this for over a month.
Is it possible to set Ip address for VM using VBoxManage?

What I've been doing is to use RDP. My physical hosts server are linux and windows and located on the East Coast while I'm in West. Therefore, I need to RDC into the host first before I can do any RDP manipulation on VM. And this thing is pretty laggy.

Many thanks!
nkhoa

Posts: 17
Joined: 3. Nov 2010, 23:40
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: win2008
Top
Re: set static IP addresses for VM using commandline
by Perryg » 9. Feb 2011, 21:19

Is it possible to set Ip address for VM using VBoxManage?

Short answer is no.

VirtualBox has nothing to do with the guests actual address. It presents a NIC and protocol.
If you want to set a static address for the guest then set it in the guest.
Perryg
Site Moderator

Posts: 16320
Joined: 6. Sep 2008, 21:55
Location: 41° 15' 31" N / 95° 56' 15" W
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX - Windows - Other
Top
Re: set static IP addresses for VM using commandline
by nkhoa » 9. Feb 2011, 21:24

Thanks for your reply!!!
nkhoa

Posts: 17
Joined: 3. Nov 2010, 23:40
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: win2008
Top
Re: set static IP addresses for VM using commandline
by HubTou » 10. Feb 2011, 22:06

Hello,

You can either:
use NAT, bind your VM to the IP you want in the host, assign names at boot time to the internal IP you have been given (10.0.2.15). See VBoxManage modifyvm "VM name" --natbindip1 "the external IP you want" (§9.9.4 in the 4.0.2 manua)
Use bridged networking, configure your VM to use DHCP, set the address dynamically through the internal DHCP, use a firewall in the host to filter DHCP dialog from getting outside. See VBoxManage dhcpserver [...] --lowerip "the external IP you want" (§8.33 in the 4.0.2 manual)

BTW, unless you want to tunnel RDP or VNC through the host, with SSH or SSL/TLS, why not connect directly with RDP into the VM?

I've always had very good response time with remote machines using a RDP server in the guest. The VNC server in the host is also very responsive, but it leaves me with two mouse pointers in graphical guests.

Best regards,

Hubert



回答好像是只能当虚拟机的网络连接是DHCP 或者hostonly才能用命令行来修改VM的IP ··· 我先试一下 桥接 dhcp这种方式·· 非常感谢,另外这个命令 我不是很熟 请问你能写 一个 DHCPserver 设置 和 hostonly设置的例子给我学习下吗? 感谢·
:em01
回复