Find the IP Addresses of KVM Virtual Machines (Command Line)
To find details about the virtual network you can use these commands:
root@slacker:~# virsh net-list
Name State Autostart Persistent
--------------------------------------------
default active yes yes
root@slacker:~# virsh net-info default
Name: default
UUID: 14a90f27-9a85-42ca-b434-6ce6c142690c
Active: yes
Persistent: yes
Autostart: yes
Bridge: virbr0
root@slacker:~# virsh net-dhcp-leases default
Expiry Time MAC address Protocol IP address Hostname Client ID or DUID
------------------------------------------------------------------------------------------------------------
2023-07-22 16:18:45 52:54:00:dd:7b:62 ipv4 192.168.122.216/24 centos7-bbk -
You will find the IP address and hostname listed in the last command’s output.
Optionally, to find the network interfaces’s addresses for a running domain called centos7-bbk:
root@slacker:~# virsh list
Id Name State
-----------------------------
3 centos7-bbk running
root@slacker:~# virsh domifaddr centos7-bbk
Name MAC address Protocol Address
-------------------------------------------------------------------------------
vnet2 52:54:00:dd:7b:62 ipv4 192.168.122.216/24
root@slacker:~#
Tags: cli, kvm, virsh, networking, motd