简体   繁体   English

virsh domifaddr<domain-name> 不显示 KVM IP</domain-name>

[英]virsh domifaddr <domain-name> does not show KVM IPs

I created a virtual machine on my centos server machine by using the virt-manager.我使用 virt-manager 在我的 centos 服务器机器上创建了一个虚拟机。
While the installation, I have set a static IP address on the KVM.安装时,我在KVM上设置了一个static IP地址。
When I tried to get the IP address of KVM from my centos server terminal by using virsh domifaddr <domain-name> , it shows nothing.当我尝试使用virsh domifaddr <domain-name>从我的 centos 服务器终端获取 KVM 的 IP 地址时,它什么也没显示。

I suspected that this might happen because I set the static IP address on the KVM.我怀疑这可能会发生,因为我在 KVM 上设置了 static IP 地址。
This is a part of my virsh dumpxml <domain-name> output.这是我的virsh dumpxml <domain-name> output 的一部分。

<interface type='direct'>
  <mac address='52:54:00:cf:67:0f'/>
  <source dev='eth0' mode='bridge'/>
  <target dev='macvtap4'/>
  <model type='virtio'/>
  <alias name='net0'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
  <source path='/dev/pts/8'/>
  <target type='isa-serial' port='0'>
    <model name='isa-serial'/>
  </target>
  <alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/8'>
  <source path='/dev/pts/8'/>
  <target type='serial' port='0'/>
  <alias name='serial0'/>
</console>

As shown above it says 'direct' as the type of the interface.如上所示,它表示“直接”作为接口的类型。 Would it be the problem?会是问题吗? and how can I fix the problem?我该如何解决这个问题?

The domifaddr command has two sources of information it can use. domifaddr命令有两个可以使用的信息源。 When using <inteface type='network'/> it consults the DHCP lease database maintained by the dnsmasq instance libvirt spawns for the virtual network.当使用<inteface type='network'/>时,它会查询由dnsmasq实例 libvirt 维护的 DHCP 租约数据库,以生成虚拟网络。 If the QEMU guest agent is installed and running, it can also query the agent for the info from the guest OS POV.如果 QEMU 来宾代理已安装并正在运行,它还可以从来宾操作系统 POV 中查询代理的信息。 The --source arg can control which data source is used. --source参数可以控制使用哪个数据源。

With your use of <interface type='direct'/> there will be no DHCP lease database available, so guest agent will be the only remaining option.使用<interface type='direct'/>将没有可用的 DHCP 租用数据库,因此访客代理将是唯一剩下的选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM