virsh domifaddr domain does not show static IP

Laine Stump laine at redhat.com
Fri Sep 10 15:47:11 UTC 2021


On 9/9/21 10:07 PM, Kaushal Shriyan wrote:
> 
> Thanks Laine for the detailed explanation. The below command worked. 
> Thanks a lot and appreciate it.
> 
> virsh domifaddr testdobssbahrainms --source agent
> 
> Name       MAC address          Protocol     Address
> -------------------------------------------------------------------------------
>   lo         00:00:00:00:00:00    ipv4 127.0.0.1/8 <http://127.0.0.1/8>
>   eth0       52:14:00:74:11:14    ipv4 192.168.0.113/24 
> <http://192.168.0.113/24>
> 
> Is there a way to find out the Static IP address if the KVM Guest VM 
> instance is shut off? Thanks in advance.

Maybe?

In the case of --source agent, the guest must be queried, and the guest 
is no longer running so it can't answer. In the other cases, libvirt is 
looking for the name of the tap device used by the guest interface, but 
the tap device no longer exists. So libvirt doesn't provide any method.

However, if the guest was recently running, there may still be an entry 
left in the arp cache, and you would be able to see it by grepping (on 
the host, of course) for the guest's MAC address, like this:

    arp -an | grep 52:14:00:74:11:14

That's not going to work if the guest has been down for longer than the 
timeout of the arp cache though (or if the guest hasn't communicated 
with the host in any manner for that amount of time).




More information about the libvirt-users mailing list