Page 1 of 1

How to set static IP with VBoxManage - intnet

Posted: 19. Jan 2016, 03:50
by cremefraiche
I have searched the forums and read through all of the documentation I could find online and could not find the answer.

I am trying assign a static IP to a VM I am placing on an intnet using only the command line.
The command I am using so far for setting up the network is:

Code: Select all

VBoxManage modifyvm XP-SP3-1.1 --nic1 intnet --cableconnected1 on --intnet test1
But this does not specify an IP/netmask.
I can make this work with `VBoxManage dhcpserver`, but I'd rather know how to do it the right way.
Any help is greatly appreciated.

Re: How to set static IP with VBoxManage - intnet

Posted: 19. Jan 2016, 04:06
by Perryg
I have never tried it so I can't say that it is even possible, but the only thing that might have a chance is "VBoxManage guestcontrol" since you are trying to modify values inside the guest.
See the users manual for the proper syntax.

Re: How to set static IP with VBoxManage - intnet

Posted: 19. Jan 2016, 04:33
by scottgus1
I agree with Perry. All the guests I have installed, various flavors of Windows and a few Linuxes, default to looking for an IP address from the network via the network's DHCP server. You have to be inside the guest to tell it to change to a static IP address with an appropriate subnet mask and gateway.

You could restrict the network's DHCP range to be just one IP address wide, I'd suppose. Then the guest would have a known IP address, but that would reduce the effectiveness of the network rather substantially.

Develop a script that makes the changes for the guest you're planning to use, then deploy that script using the tool for the guest that allows running things in the OS from remote computers, or with Perry's suggestion Vboxmanage guestcontrol. The script can be modified on the host and copied into the guest. See it all in the manual, section 8.31.

Re: How to set static IP with VBoxManage - intnet

Posted: 19. Jan 2016, 05:44
by cremefraiche
Thank you both for the reply.

For the project I am working on, restricting DHCP range should get me by.
I haven't used guestcontrol yet, but it looks like the answer I'm looking for.

Now I have to figure out the best way to automagically include GuestAdditions in the install.
Ideally I would like to be able to run a script that automates the OS installation, software install, and finally uses guestcontrol to set the static IP.
I don't have any experience preseeding windows installs, but I think I might be able to fully automate with a tool like nLite (or a linux equivalent if I can find one).
If anyone has experience with this, I'm all ears.
Thanks again.