get IP address of a running vm from CLI?

jamieInCLT

New Member
Jan 12, 2024
5
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
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!