One minute
How to get IPs of libvirt VMs
I always forget how to do it. So let’s write it here :P
Get a list of the interfaces of VM:
sudo virsh domiflist --domain THE_VM_NAME
Get the IP of an interface
sudo virsh domifaddr --domain THE_VM_NAME --interface INTERFACE_NAME
Or for all known addresses:
sudo virsh domifaddr --domain THE_VM_NAME
You can also check all DHCP leases by the hypervisor. In this case for default
:
sudo virsh net-dhcp-leases default
However, if you are using a macvtap
interface, exposing the VM on the network, this is likely to not show any address, since everything is handled by your network’s DHCP server, and thus libvirt has no knowledge about it.
Likely, you can use a sudo nmap -sn 10.1.1.0/24
or arp -a
on other network’s hosts to find the IP. Change the subnet, obviously!