[SOLVED] How to Know the VM ID or VM name with the IP in Proxmox Shell

Sahil

Member
Jun 14, 2022
32
1
6
Hi Team,

I have an IP for which I don't know what is the VM ID or the VM name I have given and there are more than 500 Vms available in 1 cluster,

How Can I find the VM Id or the Vm name through the IP address for which VM it is assigned from the main Proxmox shell,

Please help me with this issue,

Kindly do the needful,

Thanks & Regards
Sahil Ahmed F
 
Hello,

Ip addresses are configured in the guest VM.

My solution would be:
apt install qemu-guest-agent on your VM by connecting via IP over ssh for example.

Code:
systemctl enable qemu-guest-agent
systemctl start qemu-guest-agent

Now you can use qm guest cmd <vmid> network-get-interfaces on the host-machine.

Sample bash script (vmid from 100 to 200):
Code:
for i in {100..200}
do
echo $i
qm guest cmd $i network-get-interfaces | grep <ip addr>
done

You can scan your network to find the hostname and other information of the VM by using nmap. If this helps you find it.
https://www.redhat.com/sysadmin/quick-nmap-inventory
 
Last edited:
  • Like
Reactions: Dunuin
HI Mr.Markus,


Thank you for the prompt response and the help,

This will be very helpful for me.

Thanks & Regards
Sahil Ahmed F