<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 10, 2021 at 12:08 AM Laine Stump <<a href="mailto:laine@redhat.com">laine@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 9/9/21 2:11 PM, Kaushal Shriyan wrote:<br>
> Hi,<br>
> <br>
> I have assigned static IP for all the below KVM Guest VM's. Is there a <br>
> way to find out the IP of the below VM's from virsh utility or any <br>
> other utility? virsh domifaddr testdobssbahrainms does not show the <br>
> static IP.<br>
<br>
By default, "virsh domifaddr" will attempt to lookup the MAC address of <br>
the guest interface in the table of IP addresses leased from the <br>
libvirt-managed dhcp server for the network the interface is connected <br>
to. If the interface has a statically configured IP, or if it isn't <br>
connected to a libvirt-managed virtual network, then no IP addresses <br>
will be found. You can change this behavior with the "--source" option:<br>
<br>
    '--source arp'  - looks for the MAC address in the host's ARP table<br>
    '--source agent' - queries the guest agent (which must have been<br>
                       installed)<br>
<br>
Each of these has varying levels of reliability and success, depending <br>
on your specific setup. e.g., if the guests don't have the guest agent <br>
installed, that method will fail, and if the guest can't be trusted, <br>
then any information it sends also can't be trusted. Alternately, it is <br>
possible for an external device on the network to poison the ARP table <br>
with bad information, and it's also possible that the guest simply has <br>
no entry in the ARP table (if the host has never attempted to <br>
communicate with it, or if it's connected via a host interface/bridge <br>
that itself has no IP address.)<br>
<br>
Hmm, and I guess --source arp also wouldn't work for guests connected <br>
via macvtap (<interface type='direct'>) since guest<->host communication <br>
isn't supported in that case (and so the guest could never show up in <br>
the host's ARP table).<br>
<br>
Anyway if your guests are connected to a libvirt virtual network or to a <br>
Linux host bridge that has an IP address on the host, then "--source <br>
arp" should work for you.<br>
<br>
> <br>
> # virsh list --all<br>
>   Id   Name                      State<br>
> -----------------------------------------<br>
>   1    testdobssbahrainms         running<br>
>   2    testdosstomcatpibms       running<br>
>   3    testdobsstomcatkineticms   running<br>
>   4    testdobsstomcatmsbms       running<br>
>   5    testdobsstomcatfdms        running<br>
>   6    testdobsstomcathsbcnetms   running<br>
>   7    testdobsstomcatdbbms       running<br>
>   8    testdobssapigeedev         running<br>
> <br>
> #<br>
> # virt-install --version<br>
> 2.2.1<br>
> # cat /etc/redhat-release<br>
> CentOS Stream release 8<br>
> <br>
> #virsh domifaddr testdobssbahrainms<br>
> #Name       MAC address          Protocol     Address<br>
> -------------------------------------------------------------------------------<br>
> <br>
> Please guide. Thanks in advance.<br>
> <br>
> Best Regards,<br>
> <br>
> Kaushal<br>
> <br>
></blockquote><div><br></div><div>Thanks Laine for the detailed explanation. The below command worked. Thanks a lot and appreciate it.</div><div><br></div><div>virsh domifaddr testdobssbahrainms --source agent </div><div><br></div><div>Name       MAC address          Protocol     Address<br>-------------------------------------------------------------------------------<br> lo         00:00:00:00:00:00    ipv4         <a href="http://127.0.0.1/8">127.0.0.1/8</a><br> eth0       52:14:00:74:11:14    ipv4         <a href="http://192.168.0.113/24">192.168.0.113/24</a><br></div><div><br></div><div>Is there a way to find out the Static IP address if the KVM Guest VM instance is shut off? Thanks in advance. </div><div><br></div><div>Best Regards,</div><div><br></div><div>Kaushal</div></div></div>