Hello,
I'm trying to retrieve a VM's IPs using REST API request. The only request that seems to be relevant is:
/api/vcenter/vm/{vm}/guest/identity
but its response contains only one IP address while the VM has more than one.
Is there any way to get all the IP addresses of a VM?
Thanks!
List Guest Networking Interfaces in the guest operating system.
GET: https://{vCenter}/api/vcenter/vm/{vm}/guest/networking/interfaces
It lists the nic-wise ip_addresses and its mac_address.
Sample program to print the Virtual machine network details(Nic name, IPv4, Mac, Nic Key, Portgroup) using VI java API(vSphere Management SDK). - PrintVMNetworkDetails.java
Output:
Network Adatpter IP4Address Mac Key Portgroup ---------------- ---------- --- --- --------- Network adapter 1 10.10.10.6 00:15:23:31:c9:22 4000 VM Network Network adapter 2 10.20.20.7 07:89:61:14:38:66 4001 dvPortgroup
List Guest Networking Interfaces in the guest operating system.
GET: https://{vCenter}/api/vcenter/vm/{vm}/guest/networking/interfaces
It lists the nic-wise ip_addresses and its mac_address.
Sample program to print the Virtual machine network details(Nic name, IPv4, Mac, Nic Key, Portgroup) using VI java API(vSphere Management SDK). - PrintVMNetworkDetails.java
Output:
Network Adatpter IP4Address Mac Key Portgroup ---------------- ---------- --- --- --------- Network adapter 1 10.10.10.6 00:15:23:31:c9:22 4000 VM Network Network adapter 2 10.20.20.7 07:89:61:14:38:66 4001 dvPortgroup