On 8/18/20 9:10 AM, Kaushal Shriyan wrote:
Hi,
I am trying to find out the IP address of the KVM guest virtual machine.
#virsh dumpxml newsoftlinedrupalpoc | grep "mac address" | awk -F\' '{
print $2}'
52:54:00:2c:7e:ff
[root@baseserver1 ~]# arp -an | grep 52:54:00:2c:7e:ff
[root@baseserver1 ~]# virsh domifaddr newsoftlinedrupalpoc
Name MAC address Protocol Address
-------------------------------------------------------------------------------
[root@baseserver1 ~]#
It is not showing anything. I manually configure the IP
using /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
IPADDR=192.168.0.189
PREFIX=24
GATEWAY=192.168.0.10
DNS1=8.8.8.8
DNS2=8.8.4.4
This is expected. If you use static IP then libvirt spawned dnsmasq is
not involved in any way and thus libvirt doesn't know what IP address
the domain has. And by default, virsh will use '--source lease' which
means libvirt tries to get the info from the dnsmasq (well, some JSON
that dnsmasq is updating, whatever).
You can try '--source agent' if you have a guest agent configured. And
if domain has done some traffic maybe it's still in the host's ARP table
and thus '--source arp' might work too. But I'd say this is the least
reliable way because entries in the ARP table time out.
Michal