List proxmox VM/CTs for cluster with IP addresses

TwiX

Renowned Member
Feb 3, 2015
310
21
83
Hi,

Is there a way to get a list of all VM/CTs for a cluster including IP addresses ?

qm list / pct list do not provide IPs I guess.

Thanks !
 
for VMs you need to list all for all running VMs
Bash:
qm list | grep running | awk {'print $1'}
then execute command like:

Bash:
qm guest exec <VMID> -- ip a | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | head -n 2 | tail -1

and for the CT's same thing
Bash:
pct list | grep running | awk {'print $1'}
for list all running containers then exec and grep the IP

Bash:
pct exec <VMID> -- ip a | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | head -n 2 | tail -1
 

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!