Re: virsh domifaddr domain does not show static IP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 9/9/21 2:11 PM, Kaushal Shriyan wrote:
Hi,

I have assigned static IP for all the below KVM Guest VM's. Is there a way to find out the IP of the below VM's from virsh utility or any other utility? virsh domifaddr testdobssbahrainms does not show the static IP.

By default, "virsh domifaddr" will attempt to lookup the MAC address of the guest interface in the table of IP addresses leased from the libvirt-managed dhcp server for the network the interface is connected to. If the interface has a statically configured IP, or if it isn't connected to a libvirt-managed virtual network, then no IP addresses will be found. You can change this behavior with the "--source" option:

   '--source arp'  - looks for the MAC address in the host's ARP table
   '--source agent' - queries the guest agent (which must have been
                      installed)

Each of these has varying levels of reliability and success, depending on your specific setup. e.g., if the guests don't have the guest agent installed, that method will fail, and if the guest can't be trusted, then any information it sends also can't be trusted. Alternately, it is possible for an external device on the network to poison the ARP table with bad information, and it's also possible that the guest simply has no entry in the ARP table (if the host has never attempted to communicate with it, or if it's connected via a host interface/bridge that itself has no IP address.)

Hmm, and I guess --source arp also wouldn't work for guests connected via macvtap (<interface type='direct'>) since guest<->host communication isn't supported in that case (and so the guest could never show up in the host's ARP table).

Anyway if your guests are connected to a libvirt virtual network or to a Linux host bridge that has an IP address on the host, then "--source arp" should work for you.


# virsh list --all
  Id   Name                      State
-----------------------------------------
  1    testdobssbahrainms         running
  2    testdosstomcatpibms       running
  3    testdobsstomcatkineticms   running
  4    testdobsstomcatmsbms       running
  5    testdobsstomcatfdms        running
  6    testdobsstomcathsbcnetms   running
  7    testdobsstomcatdbbms       running
  8    testdobssapigeedev         running

#
# virt-install --version
2.2.1
# cat /etc/redhat-release
CentOS Stream release 8

#virsh domifaddr testdobssbahrainms
#Name       MAC address          Protocol     Address
-------------------------------------------------------------------------------

Please guide. Thanks in advance.

Best Regards,

Kaushal






[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux