set static IP addresses for VM using commandline

This is for discussing general topics about how to use VirtualBox.
Post Reply
nkhoa
Posts: 17
Joined: 4. Nov 2010, 00:40
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: win2008

set static IP addresses for VM using commandline

Post by nkhoa »

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!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: set static IP addresses for VM using commandline

Post by Perryg »

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.
nkhoa
Posts: 17
Joined: 4. Nov 2010, 00:40
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: win2008

Re: set static IP addresses for VM using commandline

Post by nkhoa »

Thanks for your reply!!!
HubTou
Posts: 93
Joined: 24. Nov 2009, 11:01
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: FreeBSD, OpenSolaris, and several Linuxes

Re: set static IP addresses for VM using commandline

Post by HubTou »

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
nkhoa
Posts: 17
Joined: 4. Nov 2010, 00:40
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: win2008

Re: set static IP addresses for VM using commandline

Post by nkhoa »

hey thanks!!
yeah.. i got 2 mouses on guests too and it's pretty laggy. I just think that it might be better to be able to set IP addresses for each VM directly from VBoxManage command
Post Reply