Page 1 of 1

Static IP for a VM

Posted: 21. Jun 2013, 03:02
by akjuturub04
Hi,

I am working on Virtual Box SDK and I have a couple of questions. Any of your suggestions would be helpful.

1. When ever I start a VM, I need to get the IP address from DHCP for the first time, but upon subsequent restarts, I want the VMs to get the same IP address. Is it possible to do programatically using the SDK? Can you please point me to the specific class/function calls?

2. Where can I get the documentation for "VirtualBoxManager" class used in TestVBox.java . The SDK reference guide provides documentation for "IVirtualBox" and all but not for "VirtualBoxManager" class. Here is how it is used in TestVBox.java

Code: Select all

VirtualBoxManager mgr = VirtualBoxManager.createInstance(null);
IVirtualBox vbox = mgr.getVBox();
 mgr.startVm(m, null, 7000);


My Setup information:
Virtual box and API version: Version 4.2.12
Connection Type: object-oriented web service (OOWS)
Language: Java
Host OS: Windows 7 64

Thanks.

Re: Static IP for a VM

Posted: 21. Jun 2013, 14:53
by noteirak
1) that is not possible directly, as Virtualbox is a hardware emulator. IP is already "software level". What you could do is use the guest execute. See IProcess, IGuestSession, IGuest, IConsole & IMachine
2) IVirtualBoxClient is the interface you're looking for.

Re: Static IP for a VM

Posted: 24. Jun 2013, 03:06
by akjuturub04
noteirak wrote:1) that is not possible directly, as Virtualbox is a hardware emulator. IP is already "software level". What you could do is use the guest execute. See IProcess, IGuestSession, IGuest, IConsole & IMachine
2) IVirtualBoxClient is the interface you're looking for.
Hi noteirak,

Thanks for the reply. If not programatically, can I configure VirtualBox so that VMs get same IP address every time?

Re: Static IP for a VM

Posted: 24. Jun 2013, 10:46
by noteirak
No you can't. IPs are OS configuration level, where Virtualbox is hardware.
What you can do is run some command in the guest using the interfaces I gave you, then you could configure the guest OS for a specific IP.