VMware {code} Community
Chandrashekhar
Contributor
Contributor
Jump to solution

why do ip address of virtual machine is null?

Hi,

I want to know IP address of virtual machine. I am able to get the ip address, but its null for all the virtual machines. How come its null ?

I am getting VM's IP address using following hierarchy :

VirtualMachine -> VirtualMachineSummary -> virtualMachineGuestSummary.getIpAddress()

I tried following hierarchy also :

VirtualMachine -> GuestInfo -> IpAddress.

With both the methods, I am getting IP address as NULL.

Does anyone knows what is the problem?

1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

I'm sure there is a document somewhere stating this information, but its a known fact that information such as this will not be available w/o VMware Tools.

The only thing I can find with a quick search on the net is: http://itknowledgeexchange.techtarget.com/virtualization-pro/vmware-tools-faq/

Do I lose out on any other functionality if I don’t install VMware Tools?

When using the VMware Infrastructure Client without VMware Tools some of the information such as IP address will not be available.

VMware Tools allows for it to access some guest attributes, so without tools it will not be able to extract some of this information and will not be accessible through the API's.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

Reply
0 Kudos
8 Replies
lamw
Community Manager
Community Manager
Jump to solution

This information is only available if the VM has VMware Tools installed, make sure you have the latest tools installed else this information will not be available.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

If you find this information useful, please award points for "correct" or "helpful".

Chandrashekhar
Contributor
Contributor
Jump to solution

thanks for quick reply. But may I know the reason behind it? Why we cannot get ip address through sdk? Is there any paper or article which explains this thing?

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso
Jump to solution

Without the VMware Tools, VMware has no information on the Operating System configuration. Once you install the VMware Tools, you can get information regarding the network, disks, etc.

Reuben Stump | http://www.virtuin.com | @ReubenStump
lamw
Community Manager
Community Manager
Jump to solution

I'm sure there is a document somewhere stating this information, but its a known fact that information such as this will not be available w/o VMware Tools.

The only thing I can find with a quick search on the net is: http://itknowledgeexchange.techtarget.com/virtualization-pro/vmware-tools-faq/

Do I lose out on any other functionality if I don’t install VMware Tools?

When using the VMware Infrastructure Client without VMware Tools some of the information such as IP address will not be available.

VMware Tools allows for it to access some guest attributes, so without tools it will not be able to extract some of this information and will not be accessible through the API's.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
Chandrashekhar
Contributor
Contributor
Jump to solution

Thank you !!! After installing vmware tools, I am able to get IP address of VM's also.

Reply
0 Kudos
ymnick
Enthusiast
Enthusiast
Jump to solution

Hi William,

Virtual machine IP address is available when VMware Tools is installed and virtual machine guest is running. If guest is not running or virtual machine is powered off, the IP address is unavailable through vSphere API ($vm->guest->ipAddress), but at the same time it is still displayed in the vSphere client. Any idea how vSphere client is making this information available for powered off virtual machines?

Thanks,

Ymnick

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso
Jump to solution

Probably cached from $vm->guest->net->ipAddress.  The inventory service may also be holding onto old values as well.  Though I do remember in the past seeing some ipAddress info in one place vs another between VM power ops.

Reuben Stump | http://www.virtuin.com | @ReubenStump
ymnick
Enthusiast
Enthusiast
Jump to solution

Thank you

Reply
0 Kudos