get IP address of a running vm from CLI?

jamieInCLT

New Member
Jan 12, 2024
6
0
1
Is there a way to get the IP address of a running VM from the CLI, assuming I know the vmid? It's set up to get one via DHCP

I've poked around pvesh and qm but thus far have had no luck.

Thanks,
-jamie
 
Last edited:
As long as the QEMU guest agent is set up for the VM, you can use the following command to get information on the network interfaces:
qm agent <vmid> network-get-interfaces
This returns a JSON string which also contains the IP addresses.
 
  • Like
Reactions: soroush.co
It's set up to get one via DHCP
If you don't have a guest agent in there, you can look for the MAC in the Leases on the DHCP Server.

Maybe it is also an option for you to make fixed assignments or use the DHCP function via the SDN feature?
 
Thanks, my issue was getting that installed and started during cloud init, and now I've got that all sorted