首先谢谢你的回答,我目前的项目有个需求,是要用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设置的例子给我学习下吗? 感谢·
