VirtualBox version - 4.3.10_Ubuntu r93012
VirtualBox API Version - 4.3.10
Connection Type - WebServer
Language - Java
OS - Ubuntu 14.04
How do I get the IPv4 address with the Java sdk, of a virtual machine which uses a bridged adapter? Is it possible?
How to get the IP Address of a virtual machine with Java sdk
-
- Site Moderator
- Posts: 5229
- Joined: 13. Jan 2012, 11:14
- Primary OS: Debian other
- VBox Version: OSE Debian
- Guest OSses: Debian, Win 2k8, Win 7
- Contact:
Re: How to get the IP Address of a virtual machine with Java
You can retrieve that info using the following method - replace <nicId> by the approprivate NIC index :
You will need the guest additions running in the VM to retrieve such info.
If you are not sure what is the right index, you can check the MAC address of the NIC in the VM config with the guest reported MAC given with the guest property /VirtualBox/GuestInfo/Net/<nicId>/MAC
Finally, the full guest NIC count is available using /VirtualBox/GuestInfo/Net/Count
Code: Select all
IMachine::getGuestPropertyValue("/VirtualBox/GuestInfo/Net/<nicId>/V4/IP");
If you are not sure what is the right index, you can check the MAC address of the NIC in the VM config with the guest reported MAC given with the guest property /VirtualBox/GuestInfo/Net/<nicId>/MAC
Finally, the full guest NIC count is available using /VirtualBox/GuestInfo/Net/Count
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Manage your VirtualBox infrastructure the free way!