ewsd12 发表于 2015-6-1 09:19:38

KVM虚拟机加入物理机网络的方法(可用于应急)

安装vnc和xauth:
yum install -y tigervnc xauth

增加一块网卡,直接连接到br-ex
virsh edit instance-00000002
增加一块网卡,
    <interface type='bridge'>
      <mac address='fa:16:3e:cd:82:1f'/>
      <source bridge='qbr317a0ffe-56'/>
      <target dev='tap317a0ffe-56'/>
      <model type='virtio'/>
      <driver name='qemu'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
      <interface type='bridge'>
      <source bridge='br-ex'/>
      <virtualport type='openvswitch'>
      </virtualport>
    </interface>

(具体xml格式可以参考:http://libvirt.org/formatdomain.html#elementsNICSVirtual)

关闭虚拟机电源:
virsh destroy instance-00000002
启动虚拟机:
virsh start instance-00000002
使用virsh和vnc连接虚拟机:
virsh vncdisplay instance-00000002
:0
vncviewer :0

进入虚拟机,将第二块网卡的地址改为业务地址


虚拟机恢复:
将虚拟机内部网络设置复原

virsh edit instance-00000002
将临时增加的interface部分去掉。

通过管理界面启动虚拟机

页: [1]
查看完整版本: KVM虚拟机加入物理机网络的方法(可用于应急)