Skip to main content

Hi Nutanix Community,

I'm working on integrating with Nutanix API v4 (/api/vmm/v4.1/ahv/config/vms) for VM discovery and need guidance on the best approach for extracting VM IP addresses.

I see multiple IP fields in the response and I'm not sure which one to prioritize:

  • nicNetworkInfo.ipv4Info.learnedIpAddresses
  • networkInfo.ipv4Info.learnedIpAddresses
  • assignedIpAddresses

and more.

  1. Is there a single field that always contains the VM's primary IP address? I'd prefer to check one reliable source instead of multiple fallbacks.

  2. What's the difference between nicNetworkInfo vs networkInfo - are they duplicates or do they serve different purposes?

Thanks!

Hi ​@Eviatar ,

I've run into the same questions when working with the Nutanix v4 API, and here’s what I’ve learned from my experience:

  1. Primary IP Address Field: There isn’t a single, always-reliable field that guarantees the primary IP for a VM. However, in most of my use cases, I’ve found networkInfo.ipv4Info.learnedIpAddresses to be the most consistent and accurate, especially when the VM has an active network connection and is communicating over the NIC. That said, I still check assignedIpAddresses as a secondary reference when needed.

  2. nicNetworkInfo vs networkInfo: This tripped me up at first too. From what I’ve seen, nicNetworkInfo is more tied to individual virtual NICs, whereas networkInfo gives a broader summary of the VM’s network interfaces. They can sometimes overlap in data, but they aren’t exact duplicates — nicNetworkInfo tends to have more granular details.

Hope that helps! Curious to hear if others have found a more definitive source for the primary IP.


Hi ​@aluciani 

Actually, there are quite a few different locations where IP addresses can be found for a single VM:

  • IpAddress via vmm.v4.1.ahv.config.Ipv4Config

  • LearnedIpAddresses via vmm.v4.1.ahv.config.Ipv4Info

  • Ipv4Config via vmm.v4.1.ahv.config.VirtualEthernetNicNetworkInfoNicNetworkInfo

  • Ipv4Info via vmm.v4.1.ahv.config.VirtualEthernetNicNetworkInfoNicNetworkInfo

  • Ipv6Info via vmm.v4.1.ahv.config.VirtualEthernetNicNetworkInfoNicNetworkInfo

  • Plus additional IPs coming from floating IP configurations, and potentially more.

This is becoming frustrating. Every time I want to retrieve all IPs associated with a VM (and make sure I haven’t missed any), I have to search across all these different fields.

I’m trying to find a way to consolidate or simplify this—ideally by using the $select parameter. However, it seems too coarse-grained. For example, I can use $select=nics, but not something more specific like:

  • $select=common.v1.0.config.IPv4Address
  • $select=common.v1.0.config.IPv6Address

or anything similar. Unfortunately, this doesn’t seem to work as expected.

Do you have any guidance or suggestions for a cleaner way to retrieve all IPs associated with a VM?

 

Thanks!