this only works if vms have dhcp assigned addresses of the network “default”!

# iterate over all vms by name
for i in $(virsh list | grep running | awk '{print $2}'); do virsh domifaddr $i; done
Name MAC address Protocol Address
vnet2 52:54:00:54:XX:XX ipv4
# for easier re-use script it
vim /scripts/kvm/list_all_ips.sh
# alternatively the manual way
virsh domifaddr debian12
Name MAC address Protocol Address
vnet2 52:54:00:54:7c:e7 ipv4

# alternatively (only lists all dhcp assigned ips)
# list all virtual networks
virsh net-list

# setup the default dhcp network (the dhcp will not be public only on the local machine)
virsh net-start default
virsh net-autostart default

virsh net-dhcp-leases default

 Expiry Time           MAC address         Protocol   IP address           Hostname    Client ID or DUID
 2024-01-08 13:08:39   52:54:00:15:XX:XX   ipv4   ubuntu      ff:56:50:4d:...
 2024-01-08 13:42:21   52:54:00:95:XX:XX   ipv4   debian12    ff:00:95:9d:6e:...
 2024-01-08 13:40:09   52:54:00:aa:XX:XX   ipv4   vmname   -


su - root
apt install netdiscover
# arp scans local network

command might be useful (does active/passive ARP scanning)


if this all did not help: checkout the hacks and scripts


GNU Linux How To – kvm qemu shutdown all vms – start all vms with keyword in name – snapshot all vms

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!